Home > Mobile >  Setting Default orientation to landscape in jetpack compose?
Setting Default orientation to landscape in jetpack compose?

Time:09-17

I saw in another question talking about how to find out the orientation, But I want to know how we can set the default orientation of an activity to Landscape in jetpack compose?

I searched through some websites and some videos in YouTube, but I couldn't find it. thanks for help

CodePudding user response:

You can access to Activity reference in Compose if you used setContent{} in Activity.

val activity = (LocalContext.current as Activity)
activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
  • Related