1

Is it possible to make the screen orientation of the background of an xml page remain in portrait even in screen rotation. I tried

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:screenOrientation="portrait"
android:background="@drawable/back">

but it doesn't work. What should i do?

Anish688
  • 81
  • 11

2 Answers2

3

Change in manifest file in activity tag of that specific activity you want to show in portrait mode only

<activity android:name="YourActivitName" 
android:screenOrientation="portrait">
</activity>
Addy
  • 2,608
  • 10
  • 52
  • 98
1
 <activity
            android:name="your activity and package name like com.example.back"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
Dakshesh Khatri
  • 652
  • 7
  • 12