:
views.setScrollPosition(R.id.lvWidget, 3);
- . setScrollPosition(int, int) RemoteViews#setInt(viewId, "smoothScrollToPosition", position);.
viewId : your ListView id
"smoothScrollToPosition" : method name to invoke on the ListView
position : position to scroll to
, .
AppWidgetManager#partiallyUpdateAppWidget(int, RemoteViews) - AppWidgetManager.java. , : ... Use with {RemoteViews#showNext(int)}, {RemoteViews#showPrevious(int)},{RemoteViews#setScrollPosition(int, int)} and similar commands...
public void partiallyUpdateAppWidget(int appWidgetId, RemoteViews views) {
partiallyUpdateAppWidget(new int[] { appWidgetId }, views);
}
As the comment indicates, call partiallyUpdateAppWidget(appWidgetId, views)after views.setScrollPosition(R.id.lvWidget, 3).
Comment also warns you: This method will be ignored if a widget has not received a full update via {#updateAppWidget(int[], RemoteViews)}. This may mean the following calls:
views.setRemoteAdapter(R.id.lvWidget, svcIntent);
views.setScrollPosition(R.id.lvWidget, 3);
should not be done in one update. I suggest you break these calls into two separate updates:
Firstly:
views.setRemoteAdapter(R.id.lvWidget, svcIntent);
mAppWidgetManager.updateAppWidget(appWidgetIds, views);
Secondly:
views.setScrollPosition(R.id.lvWidget, 3);
mAppWidgetManager.partiallyUpdateAppWidget(appWidgetId, views);
Please note that the first is a full update, and the second is a partial update.