Reputation: 19280
I have an application which contains multiples activity. I want to show all the activity layout in landscape mode for my applicaiton.
There is a common way to do that, which is declaring android:screenOrientation="landscape"
flag for each activity in android manifest file.
But this is weird when I have lots of activity and declaring that flag for all activity tag where I want to show all activity in landscape mode by default.
Is it possible or any way to declare that flag only once either manifest or activity to show all of my application activity layout in landscape mode?
Upvotes: 0
Views: 240
Reputation: 3841
There is not any a common way to do that, which is declaring android:screenOrientation="landscape"
flag for each activity in android manifest file.
You have must apply android:screenOrientation="landscape/landscape"
to each an every activity in your AndroidManifest.xml file
or
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
or
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
Upvotes: 0
Reputation: 1971
You can create BaseActivity and add layout type which you want
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
or
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
Extend BaseActivity to all activities class.
Upvotes: 1