2015-09-07 97 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()方法。