16

Good Day,

I would like to disable split screen, and get the result what is shown in "Expected Result" screenshot. (Toast with text "App doesn't support split screen")

In the "Actual Result" screen you can see how android:resizeableActivity="false" affect on the app, but still split-screen enabled. How can I disable it at all ?

Actual Result:

enter image description here Expected Result:

enter image description here

VLeonovs
  • 2,193
  • 5
  • 24
  • 44

3 Answers3

55

What I found ?

We can't set android:resizeableActivity="false" in the <application> tag it is ignored. (mistake google documentation)

It works when I set it to the main activity

 <activity
        android:name=".activities.SplashScreenActivity"
        android:label="@string/app_name"
        android:theme="@style/splashScreenTheme"
        android:resizeableActivity="false">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

    </activity>
VLeonovs
  • 2,193
  • 5
  • 24
  • 44
  • 3
    For future reference: Using `android:resizeableActivity="false"` shows a warning when not having min api set to 24 - it can be ignored because pre-api 24 ignores the tag as it has no value or action. – Zoe Jun 05 '17 at 11:44
  • 1
    Note that if you have a bunch of activities you don't need to put this flag on each one. You can put the flag in your root/launch activity and any activities that start in a new task. All other activities that are part of the same task will inherit this flag. – Markymark Apr 15 '20 at 05:53
  • 3
    The flag `android:resizeableActivity="false"` now works in `application` tag. – Wojtek Nov 24 '20 at 20:45
10

Add android:resizeableActivity="false" in application tag at manifest.xml file.

         <application
                android:name=".activity.MyApplication"
                android:allowBackup="true"
                android:icon="@drawable/btn_share_myapplication"
                android:label="@string/app_name"
                android:resizeableActivity="false"
                android:supportsRtl="true"
                android:theme="@style/AppTheme">
                <activity
                    android:name=".activity.SplashActivity"
                    android:screenOrientation="portrait">
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN" />
                        <category android:name="android.intent.category.LAUNCHER" />
                    </intent-filter>
                </activity>
        <activity... />
        </application>
Anil Singhania
  • 785
  • 10
  • 9
-4

Try to set minHeight and miWidth as in example here:

<activity android:name=".MyActivity">
<layout android:defaultHeight="500dp"
      android:defaultWidth="600dp"
      android:gravity="top|end"
      android:minHeight="450dp"
      android:minWidth="300dp" />
</activity>

Taken from: https://developer.android.com/guide/topics/ui/multi-window.html

Rafal
  • 292
  • 2
  • 10
  • 1
    For future reference: This sets the width and height of the layout that is used when the mode is set to split screen. **This does not disable split screen** - it sets the condition under which the app responds to the split screen – Zoe Jun 05 '17 at 11:42