我无法在此屏幕底部放置按钮。列表视图应位于顶部,而注销按钮必须在列表视图结束后立即显示在底部。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top"
android:background="#29A586">
<Button
android:text="Sign Out"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/SignOutButton" />
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mylistView" />
</LinearLayout>
使用下面的按钮 列表视图 与权重
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top"
android:background="#29A586">
<ListView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="@+id/mylistView" />
<Button
android:text="Sign Out"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/SignOutButton" />
</LinearLayout>