2013-07-18 62 views
1

我正在编写一个AppWidget,它具有显示用户选择的信息的视图(例如Textview),我希望我的UI事件处理程序每​​次触发UI-Event时都更新文本视图,问题是我如何通过Remoteviews仅更新的TextView,是AppWidgetManager的partiallyUpdateAppWidget方法解决,如果是真的,请告诉我它的使用,提前如何部分更新AppWidget

+0

不错的一个,如果你找到一个有用的添加它 –

回答

0

感谢,如果你把它写入API 11及以上的使用:

// Get the layout for the App Widget 
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget); 
views.setTextViewText(id,text); 
appWidgetManager.updateAppWidget(appWidgetId, views); 

在这个问题中所示 How to partially update views in an app widget without rebuilding all the RemoteViews

否则重建整个removeviews(basiclly再次调用remoteViews)