How to find out if ListView has scrolled to top Most position?

后端 未结 10 985
情歌与酒
情歌与酒 2020-12-29 03:09

I have a ListView, first its scrolled down, now when we scroll up,it reach top most point. I want to detect that .Is there any way?I am developing application with api level

10条回答
  •  悲哀的现实
    2020-12-29 03:48

    You will need to check what is the first visible position then applying Graeme's solution to see if the first visible listview item is at the top position.

    Something like lv.getFirstVisiblePosition() == 0 && (lv.getChildCount() == 0 || lv.getChildAt(0).getTop() == 0)

提交回复
热议问题