Multi-display support
Beginning with Android 8.0 (API level 26), the platform offers enhanced support for multiple displays. If an activity supports multi-window mode and is running on a device with multiple displays, users can move the activity from one display to another. When an app launches an activity, the app can specify which display the activity should run on.
Note: If an activity supports multi-window mode, Android 8.0 automatically enables multi-display support for that activity. You should test your app to make sure it works adequately in a multi-display environment.
Only one activity at a time can be in the resumed state, even if the app has multiple displays. The activity with focus is in the resumed state; all other visible activities are paused, but not stopped. For more information on the activity lifecycle when several activities are visible, see Multi-Window Lifecycle.
When a user moves an activity from one display to another, the system resizes the activity and issues runtime changes as necessary. Your activity can handle the configuration change itself, or it can allow the system to destroy the process containing your activity and recreate it with the new dimensions. For more information, see Handling Configuration Changes.
ActivityOptions
provides two new methods to support multiple displays:setLaunchDisplayId()
- Specifies which display the activity should be shown on when it is launched.
getLaunchDisplayId()
- Returns the activity's current launch display.
The adb shell is extended to support multiple displays. The
shell start
command can now be used to launch an activity, and to specify the activity's target display:adb shell start <activity_name> --display <display_id>
No comments:
Post a Comment