Reputation: 553
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.cap_im"
android:versionCode="1"
android:versionName="1.0"
>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-sdk
android:targetSdkVersion="17" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.cap_im.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN"
android:screenOrientation="landscape"
/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I used above code in android manifest to keep the screen always landscape mode.but it didnt work.above xml file is my manifest file.
Upvotes: 0
Views: 6340
Reputation: 206
use this on onCreateview setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Upvotes: 0
Reputation: 1584
I agree with @Shani Goriwal and @Tarun Droid. But I think we also need to add the android:config for each activity:
<activity
android:screenOrientation="landscape"
android:configChanges="orientation"
android:name="com.example.cap_im.MainActivity">
</activity>
Upvotes: 0
Reputation: 2104
Just remove configchanges and set this for every activity in manifest file:
<activity android:name="MyActivity"
android:screenOrientation="landscape"></activity>
Upvotes: 5
Reputation: 17580
In your activity tag you have write like this-
<activity android:name="MyActivity"
android:screenOrientation="landscape"></activity>
If you want reflect this for whole app. It should be indside your each and every activity
tag.
Upvotes: 0