问题描述
在安卓时,放置在
不起作用。但是,当我把&LT screenOrientation
标签;用途> 安卓screenOrientation
在<活性GT;
标记它的工作原理
The android:screenOrientation
tag when placed in <application>
does not work.But when I put android:screenOrientation
in a <activity>
tag it works.
如果安卓screenOrientation
标签工作在&lt;应用&GT;
那么,就没有必要把机器人:screenOrientation
处理的每个活动
If android:screenOrientation
tag works in <application>
then, there would no need to put android:screenOrientation
handling for every activity.
我在想,为什么是 screenOrientation
标记这样奇怪的行为在Android平台?
I wonder, why there is such strange behavior in Android platform for screenOrientation
tag?
推荐答案
在&lt;应用&GT;
元素不支持安卓screenOrientation
。您可以通过讲这个阅读文档。
The <application>
element does not support android:screenOrientation
. You can tell this by reading the documentation.
至于为什么它不支持在&lt;应用&GT;
元素,我想它至少部分是因为你不应该使用它的许多活动,也许不是所有的活动。
As to why it is not supported in the <application>
element, I imagine it is at least in part because you should not be using it on many activities, and perhaps not all activities.
例如,你提出的安卓screenOrientation =画像
根本不应该这样做,pretty的多如初。 风景
我可以理解,对于某些类型的活动(摄像头,视频播放器,一些游戏)。但人像
表示:
For example, your proposed android:screenOrientation="portrait"
simply should not be done, pretty much ever. landscape
I can understand, for certain types of activities (cameras, video players, some games). But portrait
means:
- 您不希望用户能够使用他们一边滑盖硬件键盘
- 您不希望用户能够使用他们的平板电脑在Android天然横向
- 您不想在谷歌电视 运行
安卓screenOrientation
应该只对那些活动的绝对肯定的有无的是在该方向使用。否则,请尊重用户的意愿来使用哪一个方向。不是让你将其设置为应用程序作为一个整体仅仅是一种方式,以确保你真正想一想它是否需要进行特定活动或没有。
android:screenOrientation
should be used only on those activities that absolutely positively have to be in that orientation. Otherwise, please respect your users' wishes as to which orientation to use. Not allowing you to set it for the application as a whole is simply one way to help ensure that you actually think about whether it is needed for a given activity or not.
这篇关于安卓:在应用screenOrientation标签不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!