Frage

I want to lock my application to portrait mode for all the activities. I know this can be done by setting android:screenOrientation="landscape" in activity tag in manifest. but I have lots of activities, so I was wondering is there any way to do it on application level either by some xml tag in manifest or in code anyhow, so I wont have to define it in all the activity tags.

War es hilfreich?

Lösung

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

Or

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

Use this method in the BaseActivity. And extend this activity for every other activity in your application.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top