0
我正在尝试在图像视图的动画中进行移动+淡入淡出。 我希望它从屏幕外部滑动到屏幕中间。 这里是我曾尝试:从外部移动图像视图
活动的xml:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/city"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="false"
android:scaleType="fitEnd"
android:id="@+id/cityImage" />
</RelativeLayout>
move.xml
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fillAfter="true">
<translate
android:fromYDelta="-70%p"
android:toYDelta="0%p"
android:duration="1500" />
</set>
移动功能:
public void move(){
ImageView image = (ImageView)findViewById(R.id.cityImage);
Animation animation1 = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.move);
image.startAnimation(animation1);
}
,你可以看到我想到了JavaScript的方式通过做-70%p,但它似乎并没有在android中工作。你能否以其他方式给我建议?
感谢的人使用100,那效果更好 –