I confuse the translation animation and rotate the animation. In my game I use these two animations, after the animation is completed I save my image. In animation translation, this is fine, but after the rotation animation is complete, my image blinks once. See my code below, please solve my problem ........
Why does no one answer my question, does he not understand, or am I asking the wrong question? Please tell me the reason .................
Thanks.
Bitmap bmp=BitmapFactory.decodeResource(getResources(),R.drawable.train); //1) TranslateAnimation TAnimation=new TranslateAnimation(0, 0, 0,-100);//bottom to start TAnimation.setInterpolator(new LinearInterpolator()); TAnimation.setDuration(2000); TAnimation.setFillAfter(false); TAnimation.setFillEnabled(true); //TAnimation.setFillBefore(true); Train.startAnimation(TAnimation); TAnimation.setAnimationListener(new AnimationListener() { public void onAnimationStart(Animation animation) { } public void onAnimationRepeat(Animation animation) { } public void onAnimationEnd(Animation animation) { RelativeLayout RL=(RelativeLayout)findViewById(R.id.rl); param=new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); param.setMargins(x, y, 0, 0); Train.setLayoutParams(param); Train.setImageBitmap(bmp); } }); //x and y values are exact position of compliting translateanimation position //2) RotateAnimation RAnimation=new RotateAnimation(0,90,50,25); RAnimation.setInterpolator(new LinearInterpolator()); RAnimation.setDuration(2000); RAnimation.setFillAfter(false); TAnimation.setFillEnabled(true); //RAnimation.setFillBefore(true); Train.startAnimation(RAnimation); RAnimation.setAnimationListener(new AnimationListener() { public void onAnimationStart(Animation animation) { } public void onAnimationRepeat(Animation animation) { } public void onAnimationEnd(Animation animation) { RelativeLayout RL=(RelativeLayout)findViewById(R.id.rl); param=new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); param.setMargins(x, y, 0, 0);//x and y values are exact position of compliting translateanimation position Train.setLayoutParams(param); Train.setImageBitmap(bmp); } });
source share