gpt4 book ai didi

android - 为什么我的 AppWidget 没有使用提供的标签?

转载 作者:太空宇宙 更新时间:2023-11-03 13:05:26 25 4
gpt4 key购买 nike

我已经在 XML 应用程序小部件提供程序中指定了 android:label,但是当您执行 Home->Widgets->... 时,指定的名称没有被使用,而是使用应用程序的名称,如果没有则使用默认值提供标签。配置中的尺寸被正确使用。

<appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android"
android:initialLayout="@layout/widget_layout"
android:minWidth="146dp"
android:minHeight="146dp"
android:label="@string/widget_title"
android:updatePeriodMillis="21600000"
>
</appwidget-provider>

然后在我的资源中:

<string name="widget_title">My Widget Name</string>

widget XML config 中引用的字符串资源已被IDE 验证,为什么没有使用字符串资源?

最佳答案

您需要在 receiver 部分的 AndroidManifest.xml 中为您的小部件指定 android:label="@string/widget_title"

不在 widget_info.xml 中的 appwidget-provider 中。

关于android - 为什么我的 AppWidget 没有使用提供的标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5555630/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com