开发者

Android how can you implement moveToPosition with a Custom Adapter

I have a simple custom adapter. I need to set the starting position to different positions at different times. When using a standard listadapter, I can simply u开发者_C百科se myCursor.moveToPosition( i ). A custom adapter using getview does not work that way. Can anyone tell me how to move the current list to the position I want?


If your ListView is available, use: getListView().setSelection( i );

(or myListView.setSelection(i); )





You can also get the current position (to return to in onResume, perhaps) by using:

int myPosition = getListView().getFirstVisiblePosition();

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜