문제

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!

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top