Android Imageview平移和缩放动画
我有一个图像和两个图像视图在相对位置不同,其中一个是有宽度和高度值。下面是布局和屏幕截图。我想使用动画,大图像移动和缩放到角落的小图像。我能做这个动画吗Android Imageview平移和缩放动画,android,animation,imageview,translate-animation,Android,Animation,Imageview,Translate Animation,我有一个图像和两个图像视图在相对位置不同,其中一个是有宽度和高度值。下面是布局和屏幕截图。我想使用动画,大图像移动和缩放到角落的小图像。我能做这个动画吗 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" androi
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="50dp"
android:src="@drawable/image1" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:src="@drawable/image1" />
</RelativeLayout>
我不知道这是否仍然相关,但对类似问题的回答可能会对您有所帮助 您需要做的唯一一件事是根据您的情况设置刻度值,例如从
new ScaleAnimation(1f, 2f, 1f, 2f, ScaleAnimation.RELATIVE_TO_PARENT, .5f, ScaleAnimation.RELATIVE_TO_PARENT, .5f);
到
例如,缩小图像的比例
前四个参数意味着:
x轴标度
缩放到x轴
y轴标度
缩放到y轴
其余参数表示图像应围绕其中心缩放
希望这有帮助 请改用对象动画制作工具!
new ScaleAnimation(2f, 1f, 2f, 1f, ScaleAnimation.RELATIVE_TO_SELF, .5f, ScaleAnimation.RELATIVE_TO_SELF, .5f);