这个。如果最后一个布局有 .6 (60%),我不明白为什么第一个布局看起来比第二个布局大。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".4" >
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".6">
</RelativeLayout>
</LinearLayout>
最佳答案
@Miguel Barra 适用于此
android:layout_width="match_parent"
替换为
android:layout_width="wrap_content"
或
android:layout_width="0dp"
在你的 both Relative 布局中
关于android - layout_weight =".4"看起来比 layout_weight =".6"大,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41688963/