override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
try {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
} catch (ignore: IllegalStateException) {}
}
이렇게 해도 익셉션만 먹는거라 세로모드 고정 됨.
themes.xml
<style name="Theme.AppCompat.Transparent.NoActionBar.Dimmed" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowIsTranslucent">true</item>
</style>
manifest.xml
<activity
android:name=".ui.MainActivity"
android:configChanges="uiMode"
android:exported="false"
android:theme="@style/Theme.AppCompat.Transparent.NoActionBar.Dimmed" />