Reputation: 183
I need to disable splash screen auto rotate.
Need to show splash screen in portrait mode only. But app must rotate with auto rotate. How to do it in android studio ?
Upvotes: 2
Views: 3400
Reputation: 1238
try this in manifiest
<activity
android:name=".SplashScreenActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"/>
Upvotes: 0
Reputation: 4023
You Can do it by couple of ways
One
Inside the onCreate
method of your activity
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Two
In manifest file
<activity
android:name=".NameOfYourSplashScreenActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Hope it helps
Upvotes: 3
Reputation: 1092
Add in Manifest file-->
<application
.........
>
<activity
android:name=".SplashScreenActivity"
......
android:screenOrientation="portrait"
/>
</application>
or for horizontal mode
<activity
...
...
android:screenOrientation="landscape">
Upvotes: 6
Reputation: 2128
In the manifest, set this for your splash screen activity:
<activity android:name=".YourActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"/>
Upvotes: 5
Reputation: 3182
Add following code to your splash screen activity declaration in Manifest
<activity android:name=".YourActivityName"
android:label="@string/app_name"
android:configChanges = "orientation"
android:screenOrientation = "portrait">
or else add
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
to YourActivity.onCreate()
you can find a sample demo file here in github
Upvotes: 2
Reputation: 1338
Add to your splash activity declaration in the manifest this lines:
<activity
android:name="SplashActivity"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden|orientation|screenSize">
Find relevant discussion here.
Upvotes: 4
Reputation: 3167
Just add below line in your manifest file, in splash activity tag
android:screenOrientation="portrait"
Something like below
<activity
android:name=".SplashActivity"
android:screenOrientation="portrait" >
Upvotes: 4
Reputation: 7974
In manifest you can set the specific activity to be in portrait mode using
android:screenOrientation="portrait"
Upvotes: 4
Reputation: 4182
In Your AndroidMainfest.xml put the screen orientation to your splash
<activity
android:name=".SplashScreenActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Upvotes: 5