over 8 years ago
Hi, Android 7 i.e nougat supports multi window mode that means at the same time two or more screens can be open like to open email on right side and gallery on left side.
So to create multi-window screen we have to use a flag in manifest named resizableActivity.
Resizable activity is one that can resize when using with multi window mode.
Require jdk : 1.8 or higher
Require sdk : 24 nougat
Require dependency :
Example :
First of all check in your activity that is device support multi window or not -
- if (!isInMultiWindowMode()) {
- someTextview.setText("Please enable multi window mode.");
- } else {
- someTextview.setText("Multi window mode enabled.");
- }
if (!isInMultiWindowMode()) { someTextview.setText("Please enable multi window mode."); } else { someTextview.setText("Multi window mode enabled."); }
declare activity in manifest like this -
and start activity from your main activity file like this :
Now in multi window mode you can also set some activity dimensions and position in the screen, only you have to set layout tag in manifest file like this :
- <activity
- android:name="com.android.multiwindowplayground.MyMinimumSizeActivity"
- android:launchMode="singleInstance"
- android:taskAffinity="">
- <layout
- android:defaultHeight="600dp"
- android:defaultWidth="850dp"
- android:gravity="top|end"
- android:minWidth="600dp"
- android:minHeight="600dp" />
- </activity>
<activity android:name="com.android.multiwindowplayground.MyMinimumSizeActivity" android:launchMode="singleInstance" android:taskAffinity=""> <layout android:defaultHeight="600dp" android:defaultWidth="850dp" android:gravity="top|end" android:minWidth="600dp" android:minHeight="600dp" /> </activity>
0 Comment(s)