LayoutTransition で公式の例を試しています。
コンテナが2つになるように変更しました。アニメーションで 1 番目 (上) のコンテナーに新しい項目を追加すると、予想どおり、2 番目 (下) のコンテナーがスライド アニメーションで下に移動します。
しかし、1 番目のコンテナからアイテムを削除すると、2 番目のコンテナ全体が 1 番目のコンテナの下に移動しますが、1 番目のコンテナはアニメーションで高さを縮小しています (アニメーションが 1 番目の最後の要素と 2 の最初の要素を再生している間) 'nd は交差しています)。
1 番目のコンテナが縮小している間に 2 番目のコンテナをスライドさせる方法はありますか?
レイアウト:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#ffffff">
<ScrollView android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout android:id="@+id/container1"
android:background="@drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:showDividers="middle"
android:divider="?android:dividerHorizontal"
android:animateLayoutChanges="true"
android:paddingLeft="16dp"
android:paddingRight="16dp" />
</ScrollView>
<ScrollView
android:layout_width="match_parent" android:layout_height="wrap_content">
<LinearLayout android:id="@+id/container2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:showDividers="middle"
android:divider="?android:dividerHorizontal"
android:animateLayoutChanges="true"
android:paddingLeft="16dp"
android:paddingRight="16dp" />
</ScrollView>
</RelativeLayout>