Support split screen in Android N+ only on tablets

2020-07-14 05:47发布

问题:

Is there a way to configure multi-window support for an activity only on screens large enough, e.g. tablet?

https://developer.android.com/preview/features/multi-window.html#configuring doesn't mention that. Setting android:minimalHeight and android:minimalWidth seems to not help, because

If the user moves the divider in split-screen mode to make an activity smaller than the specified minimum, the system crops the activity to the size the user requests.

Use case: for certain activities, it might not make sense to be run in very small (split) screen sizes. In those situations, the activity should not support multi-window mode.

回答1:

You could create multiple APKs (one for phone, one for tablet) using the tag

<supports-screens>

in your manifest, and then enable split screen support only on the tablet APK.