嗨,我在这里做一个应用程序,我需要应用旋转,将缩放动画移动到我的 imageview..我尝试使用下面的代码旋转和缩放动画效果很好,但是在缩放动画图像中没有缩放平移动画停止该位置返回的位置原来的位置有它的缩放..但我需要使用翻译动画来缩放我的图像停止的位置..我确实弄错了任何人建议我谢谢
public class MainActivity extends Activity {
ImageView i1;
TranslateAnimation moveLefttoRight1;
Animation logoMoveAnimation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
i1=(ImageView)findViewById(R.id.img);
final Animation myRotation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate1);
i1.startAnimation(myRotation);
moveLefttoRight1 = new TranslateAnimation(0, 0, 0, 200);
moveLefttoRight1.setDuration(2000);
moveLefttoRight1.setFillAfter(true);
myRotation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
i1.startAnimation(moveLefttoRight1);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
logoMoveAnimation = AnimationUtils.loadAnimation(this, R.anim.sacle);
moveLefttoRight1.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
i1.startAnimation(logoMoveAnimation);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
}
规模.xml:
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXScale="0.5"
android:toXScale="2.0"
android:fromYScale="0.5"
android:toYScale="2.0"
android:pivotX="0%"
android:pivotY="100%"
android:startOffset="0"
android:duration="1000"
android:fillAfter="true" />
旋转.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<rotate android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="0"
android:duration="3000"/>
</set>