防止Android上的屏幕旋转 [英] Prevent screen rotation on Android
本文介绍了防止Android上的屏幕旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个活动要阻止,因为我正在启动AsyncTask,并且屏幕旋转使其重新启动.
I have one of my activities which I would like to prevent from rotating because I'm starting an AsyncTask, and screen rotation makes it restart.
有没有办法告诉此活动即使用户疯狂地摇晃手机也不要旋转屏幕"?
Is there a way to tell this activity "DO NOT ROTATE the screen even if the user is shaking his phone like mad"?
推荐答案
添加
android:screenOrientation="portrait"
或
android:screenOrientation="landscape"
到<activity>
个元素
清单,您就完成了.
to the <activity>
element/s in
the manifest and you're done.
这篇关于防止Android上的屏幕旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文