How to get the first visible View from an Android ListView

前端 未结 6 1230
情歌与酒
情歌与酒 2021-01-04 15:22

Is there a way to get the first visible View out of the ListView in Android?

I can get the data that backs the first View in the Adapter but it seems I can\'t get t

6条回答
  •  被撕碎了的回忆
    2021-01-04 16:13

    You can use the following code:

    for (int i = 0; i <= conversationListView.getLastVisiblePosition() - conversationListView.getFirstVisiblePosition(); i++) {
            View listItem = conversationListView.getChildAt(i);
    }
    

提交回复
热议问题