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>
source to share
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>
source to share