[英]Rotate together a ImageView an TextView
I have an ImageView
and TextView
over it , I want to rotate them together. 我有一个
ImageView
和TextView
,我想将它们一起旋转。 I saw that I have setRotation()
method for each view, can I use it to both views together and not use it separately on each one of them? 我看到每个视图都有
setRotation()
方法,是否可以将其同时用于两个视图,而不是在每个视图中单独使用?
Try this Demo for Rotate complete view. 尝试此演示以旋转完整视图。
Rotate whole layout which contains Image & Text. 旋转包含图像和文本的整个布局。
操作简单,将它们放置在Framelayout中并旋转framelayout,我希望这可以解决您的问题
Try this. 尝试这个。 Hope this helps u.
希望这对你有帮助。
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();
也许可以将两个视图放入FrameLayout视图中,然后可以操作根视图以调用setRotation()
方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.