Optimizing Android Apps for Multi-Window Mode

James Montemagno

One of my favorite features in Android 7.0 Nougat is support for multiple applications running at the same time with the new Multi-Window mode. When the user has an application open and long presses on the app switcher button, they can select a second application to put side by side, which opens up new scenarios, such as dragging and dropping content. On tablets and other larger devices, this also enables a new freeform mode that allows applications to be fully re-sized. Out of the box applications should be able to take advantage of this new mode, as Android Activities will automatically re-size to the correct proportions when the app enters this mode. Here are two Xamarin.Android applications in the new Multi-Windows mode, one built with Xamarin.Forms and the other built with traditional Xamarin.Android.


As you can see, out of the box Multi-Window mode should be supported in your app, however, there are a lot of other optimizations that you can add that will delight your users.

Application Configuration

There are a few easy settings to enable and disable Multi-Window mode for your entire application for a single Activity when you compile against API 24.

If you’re using a sub-classed Application, you can add the ResizeableActivity attribute:

//Entire application does not support split mode
[Application (ResizeableActivity = false)]
//Main activity support split
[Activity(Label = "Monkeys",
        ResizeableActivity = true,
        MainLauncher = true, 
        LaunchMode = LaunchMode.SingleTop,
        Icon = "@drawable/ic_launcher")]

//Detail activity does not support split
[Activity(Label = "Details",
        Name = "com.refractored.monkeysapp.DetailsActivity",
        ResizeableActivity = false,
        LaunchMode = LaunchMode.SingleTop,
        ParentActivity = typeof(MainActivity))]

If this is set to true, the activity and application can be launched into split-screen and freeform modes. If you specify this on a single Activity and the user navigates to it, then the new activity will go back into full screen mode. If you’re targeting API 24 and don’t set this attribute, the default will be true.

Launching Activities Side-by-Side

Another neat feature is the ability to launch side-by-side if the user is already in a split-screen session by adding a few flags to your intent before starting the new Activity:

var intent = new Intent(this, typeof(DetailsActivity));

//Request that the new Activity launches adjacent if possible
//Required for adjacent activity mode

//If you would like a new instance of an existing activity to be created. 


Activity Configuration

Starting with Android 7.0, there’s a new Layout attribute that you can add to any Activity class that specifies additional parameters when the Activity is in Multi-Window mode. Here’s an example of specifying location along with the minimum and default dimensions when the Activity is launched into freeform mode:

    [Activity(Label = "Monkeys",
        ResizeableActivity = true,
        MainLauncher = true, 
        LaunchMode = LaunchMode.SingleTop,
        Icon = "@drawable/ic_launcher")]
    [Layout (DefaultHeight = "500dp",
             DefaultWidth = "600dp",
             Gravity ="top|end",
             MinHeight = "450dp",

Detecting Multi-Window Mode

Sometimes you may want to enable or disable parts of your user interface or functionality when the user enters Multi-Window mode. You can easily detect the new IsInMultiWindowMode boolean on any Activity.

  //Enable or disable functionality

Additionally, you can be notified when the user enters or exits Multi-Window mode by overriding the OnMultiWindowModeChanged method:

public override void OnMultiWindowModeChanged(bool isInMultiWindowMode)

Learn More

When optimizing for Multi-Window mode, there are a few other considerations to keep in mind, such as supporting drag and drop and all of the different types of configurations that users may attempt to launch your app in. Be sure to read through the official Android documentation on Multi-Window mode for a full testing check-list.


Comments are closed. Login to edit/delete your existing comments

Feedback usabilla icon