I use two different layout folders:
layout
layout-large
Now I want to ensure that the screen orientation is portrait if the layout folder is used, and landscape if the layout-large folder is used. How can I force this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The correct directory-name for the landscape layouts is ‘layout-land’, see here.
If you do this, you don’t need to do other things, Android will do the rest for you.
If you want to change to landscape based on the size of the Screen, you can check for the screen-resolution and then set the Orientation using the ‘setRequestedOrientation()’-method from the Activity class.