Programmatically enter multi-window mode in Android N

后端 未结 3 1835
旧巷少年郎
旧巷少年郎 2020-12-17 22:04

Android N has a new feature - Multi Window Mode. It enables two applications to be active side-by-side (actually one one is active, other one is paused but we can see both s

相关标签:
3条回答
  • 2020-12-17 22:34

    The SDK for API 24 introduced a new constant to toggle split screen mode from an accessibility service: https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html#GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN

    The constant can be passed to following method: https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html#performGlobalAction(int)

    Google seems to have missed to document the new constant in the performGlobalAction method. I still consider this to be an official API since Google did not mark the constant as hidden.

    You have to implement an accessibility service in your app and let the user manually enable the service in system settings->Accessibility so it might not be a viable option for all apps.

    0 讨论(0)
  • 2020-12-17 22:41

    I don't think that an api for the thing you want to do exists, You could try making your app have two fragments on each side of the screen. With a black bar in the middle, make each fragment resize according to the "X" position of the bar. :)

    0 讨论(0)
  • 2020-12-17 22:53

    As of Android N, this is not supported.

    The only supported way to enter multi-window mode is if the user manually triggers it.

    0 讨论(0)
提交回复
热议问题