开发者

Why is my AppWidget not using the label provided?

开发者 https://www.devze.com 2023-02-22 19:41 出处:网络
I\'ve specified android:label in the XML app widget provider, but the name specified is not being used when you do Home->Widgets->...Instead the name of the app is used, the default if no label is pro

I've specified android:label in the XML app widget provider, but the name specified is not being used when you do Home->Widgets->... Instead the name of the app is used, the default if no label is provided. The dimensions from the configuration are being used correctly.

<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-pro开发者_如何学Govider>

And then in my resources:

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

The string resource referenced in the widget XML config is validated by the IDE, so why is the string resource not being used?


You need to specify android:label="@string/widget_title" in AndroidManifest.xml in receiver section for your widget.

Not in appwidget-provider in your widget_info.xml.

0

精彩评论

暂无评论...
验证码 换一张
取 消