Disabling Multi-window feature for Android N not working for an activity

瘦欲@ 提交于 2019-12-03 17:15:23

问题


I want to disable multi-window support for an activity in my app. I have set resizeableActivity to false in my Manifest but when I long press recent app icon, the app still goes in multi-window mode. Below is my manifest:

<activity
    android:name=".MainActivity"
    android:resizeableActivity="false"
    android:excludeFromRecents="true"
    android:icon="@drawable/ic_launcher_home"
    android:theme="@style/AppThemeV3.CustomToolbar">
</activity>

Per documentation:

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

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.

I have also tried to set this attribute to false at application level in manifest but it still starts in multi-window mode. Any pointer on what I am doing wrong will be highly appreciated?


回答1:


The activity that is at the root of the task controls the window size. Your choices are:

  1. Trace back to all possible task root activities in your app and ensure they all also have android:resizeableActivity="false"

  2. Force this activity into another task, via Intent flags when you start it or manifest settings




回答2:


[UPDATE] set android:resizeableActivity="false" in application tag. This will work now.




回答3:


I have meet this problem before, and I try many time find that your must add android:launchMode="singleTask" && android:resizeableActivity="false" at the same time.



来源:https://stackoverflow.com/questions/38506343/disabling-multi-window-feature-for-android-n-not-working-for-an-activity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!