我正在嘗試使用official example on LayoutTransition。
我已經修改它,以便有2個容器。如預期的那樣,我將新項目添加到帶有動畫的第1個(頂部)容器,並且第2個(底部)容器與幻燈片動畫一起向下移動。
但是,當我從第1個容器中移除項目時,整個第2個容器將位於第1個容器下方,而第1個容器正在縮小與動畫的高度(而動畫正在播放第1個和第1個元素的最後一個元素2'nd元素相交)。
有什麼辦法可以讓第二個容器向上滑動而第一個容器正在收縮?LayoutTransition: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>