Hi am doing one application here when my activity starts that time i need to rotate image first then i need to move image from top to center there i have to scale my image after some time i have to in visable my imageview,i tried using below code first i applied rotate animation then i applied translate animation.after 2 seconds i applied scale animation but image is not scaling in center its taking imagview original postion(top) there its scaling but i need to scale imageview after move animation where is there at that postion i need scale image view...any one suggest how to apply different animations to single imageview.
public class A extends Activity{
TranslateAnimation moveLefttoRight1;
Animation logoMoveAnimation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.game);
final ImageView myImage = (ImageView)findViewById(R.id.imageView1);
//rotate animation
final Animation myRotation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotator);
myImage.startAnimation(myRotation);
//translate animation
moveLefttoRight1 = new TranslateAnimation(0, 0, 0, 200);
moveLefttoRight1.setDuration(2000);
moveLefttoRight1.setFillAfter(true);
myImage.startAnimation(moveLefttoRight1);
//scale animation
logoMoveAnimation = AnimationUtils.loadAnimation(this, R.anim.sacle);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
myImage.startAnimation(logoMoveAnimation);
}
}, 2000);
}
}
Use Animation listener.
when get animation end start another animation.
for better reference
http://developer.android.com/reference/android/view/animation/Animation.AnimationListener.html
http://www.techrepublic.com/blog/android-app-builder/how-to-use-android-animation-listeners/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.