View in portrait mode

In layout – not so useful

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/linearLayout1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
         android:orientation="vertical"        
        >

In the manifest – very good

<activity 
    android:name=".MyActivity" 
    android:screenOrientation="portrait"
    android:configChanges="orientation|keyboardHidden|keyboard"/>

In Code

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

Special bonus – full screen

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                                WindowManager.LayoutParams.FLAG_FULLSCREEN);

Comments are closed.