Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Setting Default orientation to landscape in jetpack compose?

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading