我想用相对布局填充父母与黑色背景,但它不工作。相对布局不填充父母与背景颜色
这是代码:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000"
android:orientation="vertical">
<!-- this should fill the parent with black but its not filling -->
</RelativeLayout>
</LinearLayout>
</ScrollView>
如果你给你的RelativeLayout匹配父项,你为什么要有LinearLayout? –
并在相对布局中添加一些调色板,然后它会在预览中显示背景颜色。 –
删除线性布局产生相同的结果 – user6731422