Android: @ Theme.Translucent Locks portrait orientation?

I created a new style to set the background as transparent, but for some reason since the app doesn't change the layout to landscape when the device is rotated. Should I specify something in a new style?

Here is the code:

< style name="Transparent" parent="android:@Theme.Translucent">
    < item name="android:windowBackground">@color/background</item>
</style>

      

+2


source to share


3 answers


I actually figured out that apparently the orientation matches the background program in the case of a transparent background, since I kept testing when Launcher is in the back, I always only got the portrait.



0


source


Until you specify android: screenOrientation to activate, use android "unspecified"

as the default, which means the system chooses the orientation.

In the case where you use the c style <item name="android:windowIsTranslucent">true</item>

, the system chooses an orientation based on the orientation of the base action on the stack. So it's hard to get your app in landscape mode because most launchers are pinned to portrait.



Just set android:screenOrientation="sensor"

for all transparent actions to force orientation regardless:

<activity
    android:name=".SomeActivity"
    android:screenOrientation="sensor"
    ...>
    ...
</activity>

      

+10


source


only in the manifest

<activity
            android:name=".Ippin_NewActivity"
            android:configChanges="keyboardHidden|orientation"
            android:label="@string/app_name" >
</activity>

      

0


source







All Articles