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 8.Pls help..
The key to a smoothly scrolling ListView is to keep the application's main thread (the UI thread) free from heavy processing. Ensure you do any disk access, network access, or SQL access in a separate thread. To test the status of your app, you can enable StrictMode .
I used NotificationListener that is a widget that listens for notifications bubbling up the tree. Then use ScrollEndNotification , which indicates that scrolling has stopped. For scroll position I used _scrollController that type is ScrollController .
Listview so have inbuild scrolling capabilities. So you can not use listview inside scrollview.
A list view is an adapter view that does not know the details, such as type and contents, of the views it contains. Instead list view requests views on demand from a ListAdapter as needed, such as to display new views as the user scrolls up or down. In order to display items in the list, call setAdapter(android.
edit
See comments below as to why, especially on different API versions (esp later ones), this isn't a foolproof way to see if you're list is at the top (padding etc). However, it does give you a start for a solution on devices below API 14:
private boolean listIsAtTop() { if(listView.getChildCount() == 0) return true; return listView.getChildAt(0).getTop() == 0; }
As far as my implementation years ago - this worked perfectly at the time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With