将ImageView和TextView一起旋转

时间:2015-09-07 04:40:05

标签: java android rotation

我有一个import datetime from rest_framework.decorators import api_view from rest_framework.response import Response from my_app.models import Gizmo, Sprocket # I used a function-based API view here, but a CBV APIView # would work just as well. Matter of personal preference... @api_view def dust_everything(request): today = datetime.date.today() Gizmo.objects.all().update(last_dusted=today) Sprocket.objects.all().update(last_dusted=today) return Response({"status_of_dusting": "successful"}) ImageView,我想将它们一起旋转。 我看到每个视图都有TextView方法,我可以将它一起用于两个视图而不是分别在每个视图中使用它吗?

4 个答案:

答案 0 :(得分:1)

Try this Demo for Rotate complete view.

旋转整个布局,其中包含Image&文本。

答案 1 :(得分:0)

它的简单方法将它们放在Framelayout中并旋转framelayout i hopse这解决了你的问题

答案 2 :(得分: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();

答案 3 :(得分:0)

也许你可以将两个视图放到FrameLayout视图中,然后你可以操作根视图来调用setRotation()方法。