我创建了一个小例子来解释我的问题。在这个例子中,我创建了一个填充整个屏幕的RelativeLayout。和3个孩子:如何填充父级相对布局中的所有空间?
- ID为中间的FrameLayout必须填补所有空白区域没有覆盖上的FrameLayout(粉红色)
- 的FrameLayout id为顶部必须表现出中等以上(红色)
- 的FrameLayout的顶部和底部ID为底部必须出现如下图所示中间(黄色)
布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/top"
android:layout_width="100dp"
android:layout_height="24dp"
android:layout_above="@id/middle"
android:background="#FFFF0000" />
<FrameLayout
android:id="@+id/middle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFF00FF" />
<FrameLayout
android:id="@+id/bottom"
android:layout_width="100dp"
android:layout_height="24dp"
android:layout_below="@id/middle"
android:background="#FFFFFF00" />
</RelativeLayout>
截图我的示例结果:
而我需要做的截图:
你有使用'RelativeLayout'? –