2

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 ?

Vickyexpert
  • 3,147
  • 5
  • 21
  • 34
BASIL VARGHESE
  • 183
  • 2
  • 11
  • 2
    There are lot of Answer available on internet.You have to search before posting any question. – UchihaSasuke Jul 12 '16 at 08:45
  • 1
    Possible duplicate of [Lock Android phone application to Portrait mode](http://stackoverflow.com/questions/5044544/lock-android-phone-application-to-portrait-mode) – Renjith Jul 12 '16 at 08:50

9 Answers9

6

Add in Manifest file-->

    <application
    .........
    >

    <activity
                android:name=".SplashScreenActivity"
                  ......
                 android:screenOrientation="portrait"
                 />

</application>

or for horizontal mode

<activity
        ...
        ...
        android:screenOrientation="landscape">
Kush
  • 1,080
  • 11
  • 15
5

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>
Arjun saini
  • 4,223
  • 3
  • 23
  • 51
5

In the manifest, set this for your splash screen activity:

<activity android:name=".YourActivity"
    android:configChanges="orientation"
    android:screenOrientation="portrait"/>
Nicola De Fiorenze
  • 1,958
  • 1
  • 17
  • 27
4

In manifest you can set the specific activity to be in portrait mode using

 android:screenOrientation="portrait"
Anirudh Sharma
  • 7,968
  • 13
  • 40
  • 42
4

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" >

Vickyexpert
  • 3,147
  • 5
  • 21
  • 34
4

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.

Community
  • 1
  • 1
Juvi
  • 1,078
  • 1
  • 19
  • 38
3

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

Mithun Sarker Shuvro
  • 3,902
  • 6
  • 32
  • 64
2

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

Dehan Wjiesekara
  • 3,152
  • 3
  • 32
  • 46
0

try this in manifiest

  <activity
    android:name=".SplashScreenActivity"
    android:label="@string/app_name"
    android:screenOrientation="portrait"/>
Mr. Mad
  • 1,230
  • 1
  • 14
  • 28