Hi I have two views in linear layout with vertical orientation as below, I want move up and move down animation when the second view is shown and hide. As if now when I show and hide the second imageview it works like sudden changes, i want to make it smooth transition using some animation.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:gravity="center_horizontal|bottom"
android:orientation="vertical"
android:paddingBottom="@dimen/small_padding"
android:paddingTop="@dimen/normal_padding"
android:weightSum="2">
<ImageView
android:id="@+id/b_icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="-4dp"
android:layout_marginTop="3dp"
android:contentDescription="@null"
android:paddingBottom="@dimen/normal_padding"
android:src="@drawable/find_books" />
<ImageView
android:id="@+id/tab_icon_shadow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/tab_icon_shadow"
android:visibility="gone" />
</LinearLayout>
您应该结合使用Translation和AlphaAnimation来使过渡平滑。
嗨,我已经添加了android:animateLayoutChanges =“ true”现在它变得平滑过渡而无需添加任何动画
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.