私のレイアウトでは、内部に 4 つのリストビューを含む線形レイアウトの 1 つに centerVertical を設定しました。それは正常に動作します。最初は各リストビューを 1 つのアイテムとして。任意のリストビューで項目をクリックすると、そのリストビューに新しい arraylist を添付します (レベル 1 メニューとレベル 2 メニューのようなものです)。コードは正常に動作しますが、レベル 2 の arraylist を使用してリストビューを更新すると、すべてのリストビューで center_Vertical プロパティが失われ、画面の上に表示されます。
これは私のレイアウトファイルです:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/container"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:splitMotionEvents="true">
<ListView
android:id="@+id/list_left"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
android:divider="@null"
android:dividerHeight="0dp"
android:layout_weight="1"/>
<ListView
android:id="@+id/list_center1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
android:divider="@null"
android:dividerHeight="0dp"
android:layout_weight="1"/>
<ListView
android:id="@+id/list_center2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
android:divider="@null"
android:dividerHeight="0dp"
android:layout_weight="1"/>
<ListView
android:id="@+id/list_right"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
android:divider="@null"
android:dividerHeight="0dp"
android:layout_weight="1"/>
</LinearLayout>
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:text="Clear Cache"/>
</RelativeLayout>
誰かがこれで私を助けることができれば、私は非常に感謝しています。