获取旋转(倾斜)角度横向视图 - Android的Java的 [英] Get Rotation (Tilt) Angle In Landscape View - Android Java

查看:357
本文介绍了获取旋转(倾斜)角度横向视图 - Android的Java的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我凑在寻找一个很好的例子,或有人试图尝试同样的事情在网络,但到目前为止,我还没有多少运气。

I've scrounged the web in search of a good example or someone trying to attempt the same thing, but so far I haven't had much luck.

我试图让我的设备旋转角度(如果你能想像)开始,在180°(平):
< ----
设备
---->

I am trying to get my Devices rotation angle (If you can imagine) starting at 180° (Flat): <---- DEVICE ---->

随着用户倾斜左和右的装置,该角度相应地调整。
随着它旋转我想简单地更新一个TextView。

As the user TILTS the device left and right, the angle adjusts accordingly. And as it rotates I want to simply update a TextView.

我只是失去了为这是什么发展,有些人提出一个陀螺仪,加速计,甚至magnometer(用户不应该要面对北正确使用我的应用程序,还是我missunderstand?),或组合。
我已经得到了一些不同的传感器工作,但没有我下面的例子完成我想要达到的目标。

I'm just lost as to what this evolves, some people suggest a gyroscope, accelerometer, even a magnometer (the user shouldn't have to face North to use my app correctly, or do I missunderstand?), or a combination. I've gotten a few different sensors to work, but none of the examples I've follow accomplish what I want to achieve.

我不希望任何与3D,只是一个计划旋转(我不确定这是否会是在1个或2个维度?)。

I don't want anything to do with 3D, just a plan rotation (I'm uncertain if this would be on 1 or 2 dimensions?).

任何人都可以转发我朝着正确的导演,或者提供一些信息?

Can anybody forward me in the right director, or provide some information?

我现在感到很浮躁。
非常感谢你!

I am very scatterbrained right now. Thank you very much!

推荐答案

您实现OrientationEventListener这会给你的设备旋转。肖像为0度。

You implement OrientationEventListener this will give you the device rotation. Portrait is 0 degree.

这篇关于获取旋转(倾斜)角度横向视图 - Android的Java的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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