上部がリスト ビューである相対レイアウト (RV1) があります。その下には、画像とボタンを保持する別の相対ビュー (R2) があります。最後に R2 の下、R1 の一番下に編集ボックスとボタン (B1) があります。
最初に、R2 は visibility(gone) に設定されているため、リストは編集ボックスのすぐ上に置かれます。ただし、ボタン B1 を押すと、R2 が表示され、リストが R2 の上に移動するようになります。
xml 設定では、リストは R2 の上に設定されています: android:layout_above="@id/R2Layout" しかし、R2 は最初になくなったように設定されているため、リストは編集ボックスの上に置かれます。それはいいです。
私の問題は、ボタン B1 を押すと R2 が表示されるが、リストが R2 にスペースを確保せず、R2 の上に移動することです。R2 とリストが重複しています。
view.invalidate() を実行してビュー全体をリフレッシュしようとしましたが、うまくいきませんでした。
どうすればこれを解決できますか?
以下はxmlコードです。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/r1"
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<EditText
android:id="@+id/et"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_toLeftOf="@+id/b1"
android:padding="5dp"
android:paddingTop="10dp" >
</EditText>
<RelativeLayout
android:id="@+id/r2"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_margin="5dp"
android:layout_height="wrap_content"
android:layout_above="@+id/et"
android:layout_alignParentLeft="true" >
<ImageView
android:id="@+id/iv"
android:visibility="gone"
android:layout_width="80dp"
android:layout_height="80dp" />
<Button
android:id="@+id/b2"
android:visibility="gone"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@+id/iv"
android:layout_alignTop="@+id/iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button" />
</RelativeLayout>
<FrameLayout
android:id="@+id/frameLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/r2"
android:layout_marginBottom="10dp" >
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:dividerHeight="2.0sp"
android:fastScrollEnabled="true"
android:smoothScrollbar="true"
android:stackFromBottom="true" />
<!-- Here is the view to show if the list is empty -->
<LinearLayout
android:id="@+id/empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<!-- If the list is empty because there are no files... -->
<TextView
android:id="@+id/empty_text"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:visibility="invisible"
android:text="List empty"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</FrameLayout>
<Button
android:id="@+id/b1"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp" />
</RelativeLayout>