开发者

Application in fixed landscape. How to detect phone orientation

I'm building android app that is only in landscape mode. How can i detect the phone orientation as fast as开发者_如何学编程 possible? I have tried with

`Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();

display.getOrientation();`

and also with the SensorEventListener, but I can't get any values for X,Y or Z? How can I do this? any solution? I was using this example for sensor. link for the sensor event listener


To keep an activity only in portrait mode add this in the manifest xml tag

android:screenOrientation="portrait"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜