문제

how can i get the rotation of the device in the four main orientations? and is there a corresponding event that i can capture?

also, is it possible to disable this rotation for my app?

thanks!

도움이 되었습니까?

해결책

Explains how to get the size and orientation of the screen. http://indyvision.net/2010/02/android-screen-size-orientation/

However, the device already changes its own behavior depending on the device orientation. For instance you can specify screen layouts dependent on the orientation, one for vertical and one for horizontal.

To prevent the Activity from rotating with the device, you can add android:screenOrientation="portrait" or "landscape" to AndroidManifest.xml for each Activity declared in your app.

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