向Android应用程序添加Samsung多窗口支持 [英] Adding Samsung multi-window support to Android application
问题描述
I went and tried to add Samsung's multi-window support for my app following this link. My app did appear in Samsung's multi-window applications tab, and I was able to drag and drop it into the screen, however my app did not behave as multi-window supported app should behave, but instead expanded to full screen.
我认为还需要进行一些其他更改才能使其正常运行,但是我不知道该怎么做.有谁知道导致这种行为的问题是什么?
I think there are some other changes that are need to be made to get it work properly, but I have no idea what. Does anyone have any ideas what could be the problem causing this behaviour?
推荐答案
此xda-developers论坛帖子包含循序渐进的指南,我在这里将其解释为这样.
This xda-developers forum post contains a step-by-step guide, which I've paraphrased here.
确保清单中的<application>
标记中包含以下内容:
Make sure your manifest contains the following somewhere inside the <application>
tag:
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow" />
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:resource="@dimen/app_defaultsize_w" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:resource="@dimen/app_defaultsize_h" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:resource="@dimen/app_minimumsize_w" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:resource="@dimen/app_minimumsize_h" />
对于所需的活动,添加到其<intent-filter>
标记:
For the desired activity, add to its <intent-filter>
tag:
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
请确保在资源文件中定义以上尺寸.
Be sure to define the dimensions above in a resource file.
在该博客文章的评论部分,用户提到最小尺寸对他造成了问题,并建议删除com.sec.android.multiwindow.MINIMUM_SIZE_W
和com.sec.android.multiwindow.MINIMUM_SIZE_H
.
In the comments section of that blog post a user mentions that the minimum size was causing a problem for him and suggested removing com.sec.android.multiwindow.MINIMUM_SIZE_W
and com.sec.android.multiwindow.MINIMUM_SIZE_H
.
一个用户指出:通过维度资源指定维度对他不起作用;他改为硬编码value属性:
One user pointed out that specifying the dimensions through a dimension resource didn't work for him; he instead hardcoded the value attribute:
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow" />
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.MINIMUM_SIZE_H" android:value="598.0dip" />
恐怕我没有Galaxy Note,所以无法尝试自己.
I'm afraid I can't try myself as I don't have a Galaxy Note.
这篇关于向Android应用程序添加Samsung多窗口支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!