how to know from adapter if the item of ListView is visible or not?

后端 未结 3 1676
终归单人心
终归单人心 2021-02-19 15:00

I have an adapter that connected to ListView, e.g.

mJournalAdapter = new JournalAdapter();
journalEntryList.setAdapter(mJournalAdapter);

and I

相关标签:
3条回答
  • 2021-02-19 15:28

    You can use getFirstVisiblePosition() will give you the first visible Item in the ListView, so you can use that in your case.

    0 讨论(0)
  • 2021-02-19 15:35

    You can get callback , overriding OnDetachedFromWindow(); method in View

    0 讨论(0)
  • 2021-02-19 15:44

    If you know the postion of that item then you can use

    int last = listView1.getLastVisiblePosition();  
    
    int first = listView1.getFirstVisiblePosition();
    
    0 讨论(0)
提交回复
热议问题