Anish688
Anish688

Reputation: 81

How can i make orientation of background remain portrait eve on screen rotation

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?

Upvotes: 1

Views: 160

Answers (2)

AddyProg
AddyProg

Reputation: 3050

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>

Upvotes: 3

Dakshesh Khatri
Dakshesh Khatri

Reputation: 629

 <activity
            android:name="your activity and package name like com.example.back"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >

Upvotes: 1

Related Questions