【发布时间】:2017-05-20 14:27:06
【问题描述】:
我在另一个框架中有一个 FrameLayout。它与中心对齐。
不,我想通过改变它的重力使其与顶部对齐,但我也想为这个改变设置动画。
我已经在https://stackoverflow.com/a/33192335/408780 找到了这个答案,但是使用那里的 LayoutTransition.CHANGING 需要 API 16。
我们的应用程序的 minSdk 是 14。任何建议如何动画重力变化?
提前谢谢你
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/bg"
android:scaleType="centerCrop"/>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:animateLayoutChanges="true">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/container_bg"/>
<EditText
android:layout_gravity="center_vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
</FrameLayout>
</FrameLayout>
【问题讨论】: