添加多窗口支持android应用多窗口、android

2023-09-12 08:26:56 作者:爱你是喜上眉梢难自控

于是,我就去尝试添加多窗口支持我的应用程序按照此link.我的应用程序没有出现在多窗口应用程序选项卡,我可以将其拖放到屏幕,但是我的应用程序并没有表现为多窗口支持的应用程序应该循规蹈矩,而是扩大到全屏。所以我觉得有被需要做得到它正常工作,其他一些变化,但我不知道。没有人有任何想法可能是导致此行为?这个问题

So I went and tried to add Multi Window support for my app following this link. My app did appear in the 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. So 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.

请确保您的清单包含以下某处的<应用> 标签:

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" />

有关所需的活性,增加其&LT;意向滤光器&gt; 标签:

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.

One用户指出的,通过一个维度资源指定的尺寸为他没有工作;他不是硬codeD值属性:

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.