Question

Hey all - I have tried to only display my app in portrait view orientation to no avail.

I have the code: android:screenOrientation="portrait" in every button, ImageView, TextView, etc... in my xml files but when I tilt the phone to the side, it still goes into landscape view.

I do call the camera in my app, but I don't think that is the issue - any thoughts?

Was it helpful?

Solution

the layout is the wrong place. you have to place it in the activity like this:

<activity android:screenOrientation="portrait" ...>

Force an Android activity to always use landscape mode

is google that hard to understand? google "android force portrait" and the first four links shows the answer... (sorry.. just had to let it out :) )

OTHER TIPS

You have to put the android:screenOrientation="portrait" in the AndroidManifest.xml.

In AndroidManifest.xml you have to do something like this:

    <activity android:name=".Your_Activity_Name"
        android:configChanges="keyboardHidden|orientation"
        android:screenOrientation="portrait"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top