Set activity screen orientation using styles
Asked Answered
Y

2

7

I'm trying to set activity screen orientation using a styles:

Here is the styles.xml:

...
<style name="Some.Activity" parent="android:Theme">
  <item name="android:screenOrientation">portrait</item>
</style>
...

and here is activity declaration in AndroidManifest.xml:

<activity android:name="SomeActivity" android:theme="@style/Some.Activity"/>

and it doesn't work.
I know that I can just set

<activity android:name="SomeActivity" android:theme="@style/Some.Activity"
    android:screenOrientation="..."/>

in the manifest, but its important to me to do that using a theme.
Ideas?

Yawl answered 13/11, 2011 at 19:9 Comment(0)
B
4

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

This link may help. Basically you have to make different layout files for each orientation and put them in corresponding layout-land or layout-port folders. You can also create layouts for different orientations on different screen sizes. For example, if not all of the controls you have for a "normal" sized screen in landscape mode fit on a small screen you can create a folder named layout-small-land and have another customized layout file.

Baedeker answered 13/11, 2011 at 19:34 Comment(1)
It is strange that this is considered the answer to the question. It does not answer the question at all.Radiator
R
0

Revising my answer here: this seems not to be supported, not all attributes are styled ones.

Radiator answered 2/4 at 8:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.