问题:在父控件为RelativeLayout的布局中,如果先写了一个ListView,再写了一个Button,
写法1:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:id="@+id/listview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/button" /> <Button android:id="@+id/button" android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignParentBottom="true"/> </RelativeLayout>如上的写法按钮可见。
写法2:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:id="@+id/listview" android:layout_width="match_parent" android:layout_height="match_parent" /> <Button android:id="@+id/button" android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignParentBottom="true" android:layout_below="@+id/listview"/> </RelativeLayout>如上的写法按钮不可见。