Hossein Kurd
Hossein Kurd

Reputation: 4555

How To Define ListView Scrolled In Android?

In Android API-8 if ListView Scrolling We Use :

listview.setaOnScrollListener()

when Items Are More Then Screen , ListView ScrollBar Shows InBehind , But If Items Are Few So ListView Scrollbar Will Hide; So if i want to know Items in ListView Are More Than Show In Screen Or Not, And ListView Is Scrolled . How To Reach I ?

Upvotes: 1

Views: 54

Answers (1)

MineConsulting SRL
MineConsulting SRL

Reputation: 2340

Basically firstVisibleItem + visibleItemCount gives you the last item shown on screen, so using this you should know if you are seeing all of them. To do this you have to extend ListView

@Override
public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int     totalItemCount) {
    if(firstVisibleItem + visibleItemCount == totalItemCount) {
         //all your items are visible
    }
}

Upvotes: 1

Related Questions