如何为Android N +

时间:2016-05-18 22:31:01

标签: android multi-window android-n-preview

在Android N的开发者预览版中,默认情况下启用了多窗口支持。如何禁用活动?如果启用多窗口的应用程序启动我的禁用活动,会发生什么?

3 个答案:

答案 0 :(得分:53)

在你的清单中,你需要:

android:resizeableActivity="false"

因此,在您的清单文件中,对于您要禁用该功能的每个活动,它将类似于:

<activity android:name=".SomeActivity"
    android:label="@string/app_name"
    android:resizeableActivity="false" />

或者,如果您想在整个应用中禁用它:

<application 
   android:resizeableActivity="false" >
    . . .
</application>

至于会发生什么,Android只是让你的应用程序进入多屏幕模式 - 它只会保持全屏。请参阅https://developer.android.com/preview/features/multi-window.htmlhttps://developer.android.com/guide/topics/manifest/activity-element.html#resizeableActivity

答案 1 :(得分:0)

Note: While starting a Unresizable Activity You should also add Intent.FLAG_ACTIVITY_NEW_TASK flag to Intent.Otherwise it will inherit the properties from the root activity.

Add android:resizeableActivity="false" for your Activity in your Manifest file or you can also add this for your Application:

<activity android:name=".YourActivity"
android:label="@string/app_name"
android:resizeableActivity="false" />

答案 2 :(得分:0)

顺便说一句,我在清单上添加了android:resizeableActivity="false",然后用Locale切换了语言,但一些Activity并没有改变语言。我注意到某些活动具有不同的资源。当我在清单中删除resizebleActivity属性时,它工作正常。