androidandroid-studiomulti-windowandroid-7.0-nougat

How to Configuring App for Multi-Window Mode?


In android Multi-Window Support , how to configure app for multi-window mode?

Which attribute need to set in manifest's activity or application node to enable or disable multi-window display?


Solution

  • The minimum requirement to enable multi-window for a specific activity (or the entire application) is to add the resizeableActivity=true parameter to the <activity> (or <application>) tag.

    Here is an overview of the Android Developers' Multi-Window Support guide:


    If your app targets Android N, 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 resizeable.

    Note: If you build a multi-orientation app with a version of the SDK lower than Android N, 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.

    Set this attribute in your manifest's activity or application node 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 Android N, but you do not specify a value for this attribute, the attribute's value defaults to true.

    Set this attribute in your manifest's activity 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 N, the layout manifest element supports several attributes that affect how an activity behaves in multi-window mode:

    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:

    <activity android:name=".MyActivity">
    <layout android:defaultHeight="500dp"
          android:defaultWidth="600dp"
          android:gravity="top|end"
          android:minHeight="450dp"
          android:minWidth="300dp" />