Disable split screen android

2019-03-26 05: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

3条回答
劳资没心,怎么记你
2楼-- · 2019-03-26 06:03

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

查看更多
forever°为你锁心
3楼-- · 2019-03-26 06:17

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>
查看更多
霸刀☆藐视天下
4楼-- · 2019-03-26 06:20

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>
查看更多
登录 后发表回答