我正在翻译两个重叠图像的平移动画,两个图像都应该从屏幕顶部平移到中间。请分享一些此类程序的示例。
帮助总是受欢迎的...谢谢!
anim.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0" android:toYDelta="50%p" android:duration="1000"/>
</set>
Animation anim = AnimationUtils.loadAnimation(activity, R.anim.anim);
anim.setInterpolator((new AccelerateDecelerateInterpolator()));
anim.setFillAfter(true);
ImageView.setAnimation(anim);
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromYDelta="-50%p"
android:toYDelta="0%p"
android:duration="2000" />
</set>
要使用此动画
Animation bottomUp = AnimationUtils.loadAnimation(this,
R.anim.animation);
tv_logo.startAnimation(bottomUp);