How to Make a Pretty DIY Window Privacy Screen

How to Build Windows Screen?

Windows Screen Shades / July 30, 2018

Android 7.0 adds support for displaying more than one app at the same time. On handheld devices, two apps can run side-by-side or one-above-the-other in split-screen mode. On TV devices, apps can use picture-in-picture mode to continue video playback while users are interacting with another app.

If your app targets Android 7.0 (API level 24) or higher, you can configure how your app handles multi-window display. For example, you can specify your activity's minimum allowable dimensions. You can also disable multi-window display for your app, ensuring that the system only shows your app in full-screen mode.

Overview

Android 7.0 allows several apps to share the screen at once. For example, a user could split the screen, viewing a web page on the left side while composing an email on the right side. The user experience depends on the device:

  • Handheld devices running Android 7.0 offer split-screen mode. In this mode, the system fills the screen with two apps, showing them either side-by-side or one-above-the-other. The user can drag the dividing line separating the two to make one app larger and the other smaller.
  • Manufacturers of larger devices can choose to enable freeform mode, in which the user can freely resize each activity. If the manufacturer enables this feature, the device offers freeform mode in addition to split-screen mode.

Figure 1. Two apps running side-by-side in split-screen mode.

The user can switch into multi-window mode in the following ways:

  • If the user opens the Overview screen and performs a long press on an activity title, they can drag that activity to a highlighted portion of the screen to put the activity in multi-window mode.
  • If the user performs a long press on the Overview button, the device puts the current activity in multi-window mode, and opens the Overview screen to let the user choose another activity to share the screen.

Multi-Window Lifecycle

In multi-window mode, only the activity the user has most recently interacted with is active at a given time. This activity is considered topmost. All other activities are in the paused state, even if they are visible. However, the system gives these paused-but-visible activities higher priority than activities that are not visible. If the user interacts with one of the paused activities, that activity is resumed, and the previously topmost activity is paused.

Note: In multi-window mode, an app can be in the paused state and still be visible to the user. An app might need to continue its activities even while paused. For example, a video-playing app that is in paused mode but is visible should continue showing its video. For this reason, we recommend that activities that play video not pause the video in their handlers. Instead, they should pause video in, and resume playback in .

When the user puts an app into multi-window mode, the system notifies the activity of a configuration change, as specified in Handling Configuration Changes. This also happens when the user resizes the app, or puts the app back into full-screen mode. Essentially, this change has the same activity-lifecycle implications as when the system notifies the app that the device has switched from portrait to landscape mode, except that the device dimensions are changed instead of just being swapped. As discussed in Handling Configuration Changes, your activity can handle the configuration change itself, or it can allow the system to destroy the activity and recreate it with the new dimensions.

If the user is resizing a window and makes it larger in either dimension, the system resizes the activity to match the user action and issues configuration changes as needed. If the app lags behind in drawing in newly-exposed areas, the system temporarily fills those areas with the color specified by the attribute or by the default windowBackgroundFallback style attribute.

Configuring Your App for Multi-Window Mode

If your app targets API level 24 or higher, you can configure how and whether your app's activities support multi-window display. You can set attributes in your manifest to control both size and layout. A root activity's attribute settings apply to all activities within its task stack. For example, if the root activity has android:resizeableActivity set to true, then all activities in the task stack are resizable.

Note: If you build a multi-orientation app that targets API level 23 or lower, and the user uses the app in multi-window mode, the system forcibly resizes the app. The system presents a dialog box warning the user that the app may behave unexpectedly. The system does not resize fixed-orientation apps; if the user attempts to open a fixed-orientation app under multi-window mode, the app takes over the whole screen.

android:resizeableActivity

Set this attribute in your manifest's or element to enable or disable multi-window display:

android:resizeableActivity=["true" | "false"]

If this attribute is set to true, the activity can be launched in split-screen and freeform modes. If the attribute is set to false, the activity does not support multi-window mode. If this value is false, and the user attempts to launch the activity in multi-window mode, the activity takes over the full screen.

If your app targets API level 24, but you do not specify a value for this attribute, the attribute's value defaults to true.

android:supportsPictureInPicture

Set this attribute in your manifest's node to indicate whether the activity supports Picture-in-Picture display. This attribute is ignored if android:resizeableActivity is false.

android:supportsPictureInPicture=["true" | "false"]

Layout attributes

With Android 7.0, the manifest element supports several attributes that affect how an activity behaves in multi-window mode:

android:defaultWidth Default width of the activity when launched in freeform mode. android:defaultHeight Default height of the activity when launched in freeform mode. android:gravity Initial placement of the activity when launched in freeform mode. See the reference for suitable values. android:minHeight, android:minWidth Minimum height and minimum width for the activity in both split-screen and freeform modes. 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.

For example, the following code shows how to specify an activity's default size and location, and its minimum size, when the activity is displayed in freeform mode:

Running Your App in Multi-Window Mode

Beginning with Android 7.0, the system offers functionality to support apps that can run in multi-window mode.

Source: developer.android.com