开发者

How to force the screen orientation to portrait before starting an App?

I am using the following line of code for each of开发者_如何学Go my activities in order to force the screen orientation to portrait mode:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

It works ok unless I put the device in landscape mode before launching the app. In this case, the activity closes suddenly.

Any idea on how to manage this case?


you need to use android:screenOrientation = "portrait" in your activity tag.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜