动画图像从下到上

时间:2017-04-21 19:29:36

标签: android xml animation

我知道我的问题需要大量的downvote,但是有人帮助我,我想为我的imageview添加动画,例如当我点击按钮从底部出现并向上移动时。喜欢这张图片

enter image description here

1 个答案:

答案 0 :(得分:4)

1。创建定义move.xml的{​​{1}}。

animation

2。创建<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator" android:fillAfter="true"> <translate android:fromYDelta="100%p" android:toYDelta="0%p" android:duration="1000" /> </set> 以显示activity_animation.xmlButton

ImageView

3。您的<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_animation" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="16dp"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" android:layout_centerHorizontal="true" android:visibility="gone"/> <Button android:id="@+id/btnStart" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Start" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true"/> </RelativeLayout> 应该是这样的:

AnimationActivity

<强>输出:

enter image description here

希望这会有所帮助〜