-3

how do i programmatically disable auto rotate in my android application to Portrait mode?

How do I disable it in this code?

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.isummit1.MainActivity" >

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="88dp"
    android:ellipsize="marquee"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"
    android:singleLine="true"
    android:text="@string/hold_on_more_things_to_come_soon_"
    android:textColor="#00FF00"
    android:textSize="20sp"
    android:textStyle="italic" />

  • 2
    possible duplicate of [How to disable orientation change in Android?](http://stackoverflow.com/questions/1512045/how-to-disable-orientation-change-in-android) – Stephan Branczyk Dec 25 '14 at 22:14

1 Answers1

0

Go to your manifest and add this line to each activity that you would like to be forced in a specific orientation Portrait or Landscape

android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden|screenSize"

Kostas Drak
  • 3,222
  • 6
  • 28
  • 60