开发者

android listview first visible position [duplicate]

开发者 https://www.devze.com 2022-12-16 13:33 出处:网络
This question already has answers here: ensure visible on android listview? (5 answers) Closed 8 years ago.
This question already has answers here: ensure visible on android listview? (5 answers) Closed 8 years ago.

How can I change the first visible item in a list view (I searched a method such as setFirstVisiblePo开发者_如何学运维sition) ?


ListView.getFirstVisiblePosition()  

Returns the position within the adapter's data set for the first item displayed on screen. Once you have the position, you can alter the item at that position in your adapter.

Presume my Adapter is binding a String[] to a ListView. I can use getFirstVisiblePosition() method on the listview instance, which will return the index/position of the first visible item, I can then change my String item at the "index"th position and alter the list.


Have a look at this question.

0

精彩评论

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

关注公众号