Android 手机水平时确定滚动角度(上/下)?
当 Android 手机侧放(水平方向)时,可以说,Roll 代表倾斜。当手机垂直于地面(直视屏幕)时,滚动显示 90。但是,当您开始向前或向后倾斜手机时,就像您想向下或向上看一样,角度只会减小。
这意味着向上或向下看 45 度会产生相同的滚动或 45 度。
如何知道您是向前滚动还是向后滚动?
我一直在寻找这个问题的答案,但找不到其他人遇到这个问题。从不同的应用程序来看,这似乎是可能的,所以我认为我只是缺少与某些事物的某种关系,并且希望有人能够将我推向正确的方向。谢谢!
When the Android phone is on its side (horizontal orientation), the Roll represents the tilt, so to speak. When the phone is perpendicular to the ground (looking directly at the screen), the roll says 90. However, when you start tilting it forward or backward, as if you wanted to look down or up, the angle just decreases either way.
This means looking up or down 45 degrees gives the same roll or 45 degrees.
How is it possible to know if you are rolling it forward or backward?
I have been looking around for an answer to this, and can't find anyone else with this problem. Judging from different apps, it seems to be possible, so I think I am just missing some relationship to something, and was hoping someone might be able to nudge me in the right direction. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决这个问题的方法是使用加速度计数据。观察Z轴是正还是负,然后相应地调整滚动值。
The way I fixed this was with the accelerometer data. Watch to see if the Z axis is positive or negative, and then adjust the roll value accordingly.