Resizable Apps & Multi-Window Support in Android

Mar 30 2021 · Kotlin 1.4, Android 11, Android Studio 4

Part 1: Resizable Apps & Multi-Window Support in Android

03. Enable The Resizable App Feature

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 02. Set Up The Project Next episode: 04. Handle Multi-Window Lifecycle

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Transcript: 03. Enable The Resizable App Feature

In order to enable the resizable app feature in your apps, you can do two things. You can either enable the resizableActivity flag for your entire app, to make everything support the resizable mode, or you can enable the same flag on a per-Activity-basis, allowing only certain activities to support resizability.

Another thing which lets you handle resizability, specifically when it comes to changes in the screen configuration is adding flags that specify which config changes you’ll handle instead of the system.

To do that, you add the configChanges flag to each Activity. You can specify many different config changes to handle, such as changes in the screen size, layout, orientation and so on. Let’s add these flags to support the Multi-Window feature!

Open the AndroidManifest.xml file and add the following flag to the application tag:

<application
  android:resizeableActivity="true">

Using this flag, you’ve just enabled multi-window support for your app! :] Pretty cool, right? Note that it’s best to add this flag to specific activities, as sometimes only a select few parts of the app are well optimized for split-screen use.

If you want to enable resizability just for a specific activity, and also add appropriate config changes handles, add the following code:

<activity
  android:configChanges="screenSize|screenLayout|smallestScreenSize|orientation" //
  android:resizeableActivity="true"> // here

You can add the resizableActivity flag to each Activity. That way you’re sure only the screens you’ve properly set up for multi-window support can run in split-screen.

Additionally, you’ve added the configChanges flags, which lets you handle the screen size and smallest screen size changes and configuration, if the screen layout changes and if the orientation changes.

All of these events can happen if you enter or leave the split screen mode. Finally, add the same config changes flag to the other Activity:

<activity
  android:name=".ui.addNote.AddNoteActivity"
  android:configChanges="screenSize|screenLayout|smallestScreenSize|orientation" //
  android:windowSoftInputMode="adjustPan|adjustResize" />

That’s it! Now you’re set up to use the split screen mode, also known as multi-window support. To test if your app is ready, build and run the project and let’s start the split screen mode.

Now that you have the app open, press the Overview button, the third, square button in the navigation bar. Once you’re there, click on the app icon at the top and you’ll see a new popup menu.

Now you’ll see an option “Split screen” in the menu, so click on that. Once you click on it, you’ll get to choose another app to use in split screen mode.

I chose Google Chrome as I know it has split screen support. Your app now works in split-screen mode! :] Now you can start working on the rest of the feature!