android view rotation animation does not rotate the focus area of it?
I am rotating a rectangle area view and applying the transformation after in this manner
AnimationSet snowMov1 = new AnimationSet(true);
RotateAnimation rotate1 = new RotateAnimation(0,-90, Animati开发者_StackOverflow中文版on.RELATIVE_TO_SELF,0.0f , Animation.RELATIVE_TO_SELF,0.0f );
rotate1.setDuration(000);
snowMov1.addAnimation(rotate1);
TranslateAnimation trans1 = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 1.0f);
trans1.setDuration(000);
snowMov1.addAnimation(trans1);
snowMov1.setFillAfter(true); //this will apply the animation and keep the transformation
This however does not rotate the focus area of that view. The focus area remains the same. Can someone please help me how the focus area can be rotated as well ??
Thank you.
Unfortunately, there is no way to do this automatically. Animations only update the drawing position of views, and not their actual position. Your best bet here would be to set a listener for the animation and to actually change the position in the onAnimationEnd
method.
精彩评论