Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make an application to run in portrait mode only

Tags:

android

In my application If i want to restrict an activity to work in portrait mode only then i have to write android:screenOrientation="portrait" in the manifest file against activity tag. If I want to force all activity to work in portrait mode then I have to write the same in all activity. Is there any application-wise setting so that I need not have to write this in all activities. How to make an application to run in portrait mode only

I am using the following now

        <activity
        android:screenOrientation="portrait"
        android:configChanges="keyboardHidden|orientation"
        android:name=".MyActivity"></activity>
like image 273
Sunil Kumar Sahoo Avatar asked Jul 05 '11 10:07

Sunil Kumar Sahoo


People also ask

How do I force an app to stay in portrait mode?

Android Settings Start by going to Settings => Display and locate the “Device rotation” setting. On my personal cell phone, tapping this will reveal two options: “Rotate the contents of the screen,” and “Stay in portrait view.”

How do I make my Android apps portrait only?

If you want to develop an application in portrait mode, add screenOrientation inside application tag. In the above result it is showing only portrait mode. now turn your device it not going to change the view according to orientation.

How do I make an activity portrait?

In onCreate() of your Application class, include the following code. Show activity on this post. use these line inside your application tag. it may help you or use this line android:screenOrientation="portrait" with each activity.


1 Answers

Only way is to add android:screenOrientation="portrait" for each activity.

like image 87
evilone Avatar answered Oct 01 '22 17:10

evilone