Is there a way to make an application completely ignore a screen orientation change?
Is there a way to make an application completely ignore a screen orientation change?
Share
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.
It is possible, quite easily, to override the default behavior and forbid a screen orientation change when the keyboard is open/closed.
Modifying the manifest
Open the manifest, switch to the Application tab and select the desired Activity you wish to override for the orientation change behavior.
Within Attributes you need to change two fields:
Screen orientation: select either portrait or landscape – whichever is desired. This will be the default layout.
Select events for Config changes you wish to override:
In this case these are keyboardHidden and orientation.
Modifying the Activity implementation
Now you need to override a single function within desired Activity.
Just add the function below to your Activity’s class.
This is the default implementation if using the
Source->Override/Implement Methodsmenu option.
That’s it! Now your orientation will always be kept.
Remember that this setting is per Activity – so you need to repeat this step for each Activity you wish to forbid the orientation change!
(Based on SDK 1.1)