Search code examples
androidxmlvieworientationportrait

Forcing 'portrait' orientation not working - any tips?


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?


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 :) )