我正在创建自己的启动器,并创建一个活动以使用以下代码显示所有已安装的小部件:
//get widgets list
private void getWidgetsList(){
int appWidgetId = mAppWidgetHost.allocateAppWidgetId();
List<AppWidgetProviderInfo> infoList = mAppWidgetManager.getInstalledProviders();
for (AppWidgetProviderInfo info : infoList) {
if (info.configure == null) {
AppWidgetHostView hostView = mAppWidgetHost.createView(this, appWidgetId, info);
hostView.setAppWidget(appWidgetId, info);
layoutWidgets.addView(hostView);
appWidgetId = mAppWidgetHost.allocateAppWidgetId();
}
}
}
所有小部件都已导入并成功添加,但是它们没有响应,当我单击任何小部件时都没有反应。 有人可以帮我吗,谢谢