![](/img/trans.png)
[英]It is possible to known when the screen orientation is changed but with portrait mode forced on manifest?
[英]Screen orientation forced to portrait, but still, the activities will rotate to landscape when tilted!! How to force portrait mode?
我已經在stackoverflow上搜索了此內容,但沒有找到我想要的任何解決方案。
在清單文件中,我為每個活動編寫了以下行
android:screenOrientation="portrait" android:configChanges="orientation|keyboardHidden"
但仍然,所有活動都會在傾斜手機時旋轉到橫向。
我該如何解決這個問題?
“從前,我是C / C ++,iOS,Java,Javascript,C#的自信開發人員,但感謝android!現在我什至無法與鏡子並駕齊驅!”
也許這會有所幫助
在您的主要活動之后的清單文件中,在下面的行中編寫
android:screenOrientation="portrait"
或在setContentView()之后的代碼中添加此行。
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.