使用样式设置活动屏幕方向

Get*_*ame 5 android themes screen-orientation android-activity

我正在尝试使用样式设置活动屏幕方向:

这是styles.xml:

...
<style name="Some.Activity" parent="android:Theme">
  <item name="android:screenOrientation">portrait</item>
</style>
...
Run Code Online (Sandbox Code Playgroud)

这是AndroidManifest.xml中的活动声明:

<activity android:name="SomeActivity" android:theme="@style/Some.Activity"/>
Run Code Online (Sandbox Code Playgroud)

它不起作用.
我知道我可以设置

<activity android:name="SomeActivity" android:theme="@style/Some.Activity"
    android:screenOrientation="..."/>
Run Code Online (Sandbox Code Playgroud)

在清单中,但使用主题对我来说很重要.
想法?

Mr.*_*urg 5

http://developer.android.com/guide/practices/screens_support.html

此链接可能有所帮助.基本上,您必须为每个方向制作不同的布局文件,并将它们放在相应的layout-land或layout-port文件夹中.您还可以在不同的屏幕尺寸上为不同的方向创建布局.例如,如果不是所有用于横向模式的"普通"大小屏幕的控件都适合小屏幕,则可以创建名为layout-small-land的文件夹,并具有另一个自定义布局文件.