문제

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?

도움이 되었습니까?

해결책

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

다른 팁

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"/>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top