2011-10-11 110 views
1

我旋转矩形区域视图,并以这种方式android视图旋转动画不会旋转它的焦点区域吗?

 AnimationSet snowMov1 = new AnimationSet(true); 
     RotateAnimation rotate1 = new RotateAnimation(0,-90, Animation.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 

这之后应用转换但是不旋转该视图的重点领域。重点领域保持不变。 有人可以帮助我如何重点区域可以旋转?

谢谢。

回答

2

不幸的是,没有办法自动做到这一点。动画仅更新视图的绘制位置,而不是其实际位置。这里最好的选择是为动画设置一个监听器,并实际改变onAnimationEnd方法中的位置。