Skip to content Skip to sidebar Skip to footer

Android Portrait And Landscape

I locked my app on portrait mode for mobile devices, and landscape for TV. The issue is, I want it on the whole app. I have multiple activities inside my app, so I have to check ev

Solution 1:

You can set the screenOrientation as 'behind' in Manifest file for all activities other than MainActivity.

This makes all the activities to keep the orientation same as that of behind activity. So if you have already locked the orientation for MainActivity, then all the activities started from MainActivity will keep same orientation of MainActivity.

Solution 2:

Create BaseActivity, add this function into it and your activities will extend BaseActivity.

Solution 3:

The positions of different Views appear different in Landscape and Portrait mode. If you are okay with the changed positions, then its fine. Otherwise, sometimes the positions are changed so dramatically that the layout does not appear good which is why you have to arrange the Views manually for both Portrait and Landscape mode.

Post a Comment for "Android Portrait And Landscape"