2015-09-07 44 views
1

我有一个ImageViewTextView在上面,我想旋转它们在一起。 我看到我对每个视图都有setRotation()方法,我可以将它同时用于两个视图,而不是分别在每个视图上使用它们?一起旋转一个ImageView一个TextView

+0

尝试将setRotation()实现为父级布局,而不是每个子级。 –

回答

0

其简单的做请将它们的FrameLayout和旋转的FrameLayout我hopse问题得以解决

0

试试这个。希望这可以帮助你。

ObjectAnimator anim = ObjectAnimator.ofFloat(view, "y", 100f); 
arrayListObjectAnimators.add(anim); 

ObjectAnimator anim1 = ObjectAnimator.ofFloat(view, "x", 0f); 
arrayListObjectAnimators.add(anim1); 

ObjectAnimator[] objectAnimators = arrayListObjectAnimators.toArray(new ObjectAnimator[arrayListObjectAnimators.size()]); 
AnimatorSet animSetXY = new AnimatorSet(); 
animSetXY.playTogether(objectAnimators); 
animSetXY.duration(1000); 
animSetXY.start(); 
0

也许你可以把你两个视图成的FrameLayout观点,那么你可以使用根视图调用setRotation()方法。