填充父窗体布局问题

有时一个布局文件中有两个或两个以上的并列的控件,以水平布局为例,有两个控件,第一个控件width固定宽度,height为match_parent,如果想让第二个控件填充父窗体剩下所有的空间,直接match_parent或fill_parent肯定不行,可以这样做。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@drawable/bg_student">

<ExpandableListView android:id="@+id/exlist"
android:layout_width="322dp"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"/>

<RelativeLayout
android:id="@+id/rl_chat"
android:layout_toRightOf="@id/exlist"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

</RelativeLayout>

</RelativeLayout>

原文地址:https://www.cnblogs.com/wangyuehome/p/2974852.html