Disable split screen android

不羁岁月 提交于 2019-11-29 07:23:02

问题


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:

Expected Result:


回答1:


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>



回答2:


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>



回答3:


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



来源:https://stackoverflow.com/questions/40259027/disable-split-screen-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!