ANDROIDN Multi-Window support

Source: Internet
Author: User

Android N can display multiple application windows at the same time. On your phone, two apps can be displayed side-by-sides or up and down in Split-screen mode. For example, the user can chat in the window above QQ, the following window to send text messages.

, two apps are displayed up and down in Split-screen mode:

How do I make your app support multiple Windows?

If your app supports Adnroid N, you can enable or disable multi-window display in the Androidmanifest.xml file by setting Android:resizeableactivity to or from the node:

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

If the value of this property is true,activity and free mode start, if the value of this property is False,activity, the Multi-window mode is not supported.

If your app supports Adnroid N, but does not set a value for this property. The value of this property defaults to True. That is, the multi-window mode is supported by default.

Users can switch to multi-window mode in the following ways
    • If you open the overview screen and press and hold the activity title, you can drag the activity to the highlighted area of the screen to bring the activity into the Multi-window mode.
    • If the user presses the overview button, the current activity on the device enters the multi-window mode and the overview screen opens, where the user can select another activity to share the screen with.
Multi-Window life cycle

The Multi-window mode does not change the Activity life cycle.

In multi-window mode, only the activity that has recently interacted with the user at a specified time is active. The activity will be considered the top activity. All other Activity, although visible, is paused. However, these paused but visible activity has a higher priority than the invisible activity in the system. If the user interacts with one of the paused activity, the activity resumes, and the previous top-level activity pauses.

Layout properties in multi-window mode

For Android N, you can set a label in the Activity tab. Tags support the following properties that affect the effect of Activity in the Multi-window mode:
-Android:defaultwidth The default width in multi-window mode.
-Android:defaultheight The default height in multi-window mode.
-Android:gravity The initial position in multi-window mode.
-Minimum height and minimum width in android:minimalheight, android:minimalwidth Multi-window mode. If the user moves the dividing line in Split-screen mode so that the activity size falls below the specified minimum value, the activity is clipped to the size requested by the user.

For example, the following configuration specifies the default size, position, and minimum size of activity when activity is displayed in multi-window mode:

<activity android:name=".MyActivity">    <layout android:defaultHeight="500dp"          android:defaultWidth="600dp"          android:gravity="top|end"          android:minimalHeight="450dp"          android:minimalWidth="300dp" /></activity>
Multi-window change notification and query

The following new methods have been added to the Activity class to support multi-window display.

Activity.isInMultiWindowMode()  判断是否处于多窗口模式Activity.onMultiWindowModeChanged()  

In fact, many windows should be used in the work of little chance, after all, mobile phone screen is relatively small, sub-screen can not see what interface. But as a developer we need to find out what Android 7.0 has updated.

SOURCE download

Android N Multiple windows

ANDROIDN Multi-Window support

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.