android:layout

xiaoxiao2021-02-28  133

问题:在父控件为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> 如上的写法按钮不可见。

转载请注明原文地址: https://www.6miu.com/read-33655.html

最新回复(0)