親が 2 つの子を持つ FrameLayout であるレイアウトがあります。最初の子は ListView で、2 番目の子も ListView です。誰もが知っているように、Second Child は最初の子をカバーしています。2 番目の子をプログラムで移動して、最初の子の一部を表示します。リストビューを更新すると同時に(リストビューが表示されているときにリストビューを更新する必要があります)、2番目の子はデフォルトの位置(左上隅-0,0)に自動的に移動します。
実際には、2 番目の子は、私が移動した場所にあるはずであり、既定の位置に来ることはありません。そして、リストビューの内容を変更するために、アダプターを設定しています(notifyDataSetChangedも使用しましたが、結果は同じです)。
2番目の子供を動かないようにする方法を知っている人はいますか???
xml は次のとおりです。
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ms_complete"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@color/message_background" >
<!-- first child -->
<ListView
android:id="@+id/options"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="false"
android:scrollbars="none"
android:smoothScrollbar="true" >
</ListView>
<!-- second child -->
<ListView
android:id="@+id/msgs"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/message_background"
android:focusableInTouchMode="false"
android:smoothScrollbar="true" >
</ListView>
</FrameLayout>