如何在Android中按Y轴旋转视图? [英] How can I rotate a View by Y-axis in android?

查看:112
本文介绍了如何在Android中按Y轴旋转视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用中,我想通过 setRotationY()旋转 ImageView 。实际上,确实如此。就像从b到d,镜像效果一样,当我在 setRotationY()之前使用 setRotation(45)时,结果是 setRotationY 是根据设备 Y轴而定的,而我希望 rotationY 根据自己的看法。

In my app, i would like rotate an ImageView by setRotationY(). In fact, it does. Just like from b to d, mirror effect and when i use setRotation(45) before setRotationY(), the result is that setRotationY is according to the device Y-axis, and i want the rotationY according to view self.

如何?你能指导我吗?
谢谢!

How? Can you guide me? Thanks!

推荐答案

ObjectAnimator animation = ObjectAnimator.ofFloat(view, "rotationY", 0.0f, 360f);
    animation.setDuration(3600);
    animation.setRepeatCount(ObjectAnimator.INFINITE);
    animation.setInterpolator(new AccelerateDecelerateInterpolator());
    animation.start();

这篇关于如何在Android中按Y轴旋转视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆