List of multiple widgets under app name?
I've been searching for hours for answer to this: How do I make all my widgets appear under my app name when choosing a widget? I've created a bunch of different AppWidgetProviders for each widget size, but they all just list separately in the top le开发者_如何转开发vel of the widget list. Example:
<receiver
android:name=".WidgetProvider1x1"
android:label="@string/widget_1x1" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/widget_info_1x1" />
</receiver>
<receiver
android:name=".WidgetProvider1x2"
android:label="@string/widget_1x2" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/widget_info_1x2" />
</receiver>
<receiver
android:name=".WidgetProvider1x3"
android:label="@string/widget_1x3" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/ widget_info_1x3" />
</receiver>
This is just directly under in my manifest - does it need a different hierarchy or a different naming scheme?
You can't do this. There is a replacement AppWidgetPicker for Rooted phones that does this automatically - AppWidgetPicker
You best bet is to define just one widget and setup your widget configuration activity to show a list of different Widget sizes / configurations, and based on user selection setup the appropriate view on the Widget.
精彩评论