问题
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.
I am trying to get my Devices rotation angle (If you can imagine) starting at 180° (Flat).
As the user tilts the device left and right, the angle adjusts accordingly. And as it rotates I want to simply update a TextView.
I'm just lost as to what this evolves, some people suggest a gyroscope, accelerometer, even a magnometer, or a combination. I've gotten a few different sensors to work, but none of the examples I've followed accomplish what I want to achieve.
I don't want anything to do with 3D, just a plan rotation.
Can anybody forward me in the right director, or provide some information?
Thank you very much!
回答1:
You implement OrientationEventListener this will give you the device rotation. Portrait is 0 degree.
来源:https://stackoverflow.com/questions/15737762/get-rotation-tilt-angle-in-landscape-view-android-java