<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollView1"
android:background="#000000"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/linear1"
android:background="#FF0000"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:background="#00FF00"
android:id="@+id/linear2"
android:layout_width="match_parent"
android:layout_height="200dip"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:background="#0000FF"
android:id="@+id/linear3"
android:layout_width="match_parent"
android:layout_height="100dip"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
这是我的布局,我希望看到红色背景(因为 linear1 具有红色背景并具有填充父级的属性),另外两个布局在 linear1 上带有绿色和蓝色 bacgroudns
但我实际上看到的是滚动视图中的黑色背景和线性2和线性3中的绿色和蓝色,但线性1中没有红色背景
即线性的行为就像 android:layout_height="wrap_content" 设置不是 android:layout_height="match_parent"
有任何想法吗 ?