我有一个ImageView图像。我需要旋转这个图像90去油脂,然后从左到右移动这个图像。我管理如何做到这一点。我用AnnimationListener和旋转完成后我开始moveAnimation()。但在运动图像返回到原始外观之前(旋转之前)。旋转Android:旋转动画和移动动画组合
XML代码rotation.xml
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:interpolator="@android:anim/linear_interpolator"
android:toDegrees="90"
android:pivotX="50%"
android:pivotY="50%"
android:duration="1000"
android:startOffset="0"
/>
rotateAnimation()
private void rotateAnimation(){
Animation rotation = AnimationUtils.loadAnimation(getContext(), R.anim.rotate);
rotation.setRepeatCount(0);
rotation.setFillAfter(true);
rotation.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(Animation animation) {
moveAnnimation();
}
});
moveAnnimation()
private void moveAnnimation(){
TranslateAnimation moveLefttoRight = new TranslateAnimation(0, 2000, 0, 0);
moveLefttoRight.setDuration(1000);
moveLefttoRight.setFillAfter(true);
moveLefttoRight.setAnimationListener(new AnimationListener() {
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
public void onAnimationEnd(Animation animation) {
// TODO Auto-generated method stub
}
});
image.startAnimation(moveLefttoRight);
}
你能举出你用来旋转和移动图像的示例代码。 – Shachillies 2012-08-10 09:45:47
好的,但我给你我的意见..尝试使用矩阵旋转和类似的矩阵翻译,这样你的矩阵将集中和图像视图将不会重置。不要忘记在执行任何矩阵操作之前将imageview的属性scaletype设置为矩阵。 – Shachillies 2012-08-10 09:46:22
添加代码看看吧plz – haawa 2012-08-10 16:55:00