布局权重不起作用。两个文本视图消失,列表未正确显示。我分别尝试了 1 3 1 3 ,但似乎效果不佳。我尝试了百分比,也没有工作。更改 wrap_content 以填充父级并且也不起作用。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/shelves_header" />
<ListView
android:id="@+id/fragment_shelvesMenu_shelvesList_listView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/light_grey"
android:paddingLeft="@dimen/list_padding"
android:paddingRight="@dimen/list_padding" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/shelves_others" />
<ListView
android:id="@+id/fragment_shelvesMenu_othersList_listView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/light_grey"
android:paddingLeft="@dimen/list_padding"
android:paddingRight="@dimen/list_padding" />
</LinearLayout>