ListView OverScroll

I populate a listView, then I wanted to do something unusual. I tried adding the OverScroll title to the list, the effect I expected was that if I cross the list, drawable would appear at the top of the list, so the overscroll title looks like a hidden title for the list.

I installed overScrollHeader and overScrollMode in the XML layout file, however, nothing has changed. I did it on the Nexus S.

So what can I expect from overScrollHeader and how to make it work?

I really would appreciate it if someone could help me.

+6
source share
2 answers

You can check out http://jasonfry.co.uk/?id=27 . However, it does not work for Android versions 2.3.

+3
source
1) create a layout above your listview and status of this layout is gone (here is rlSearch) 2) in your activity, in action scroll, you get action motionEvent and check if listview is on the top and scroll down, you visible gone layout. here is my example and it work for me. listView.setOnScrollListener(new AbsListView.OnScrollListener() { boolean isScrollDown; float firstPosition = -1; @Override public void onScrollStateChanged(final AbsListView view, int scrollState) { view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (firstPosition == -1) { firstPosition = event.getRawY(); return false; } if (event.getRawY() > firstPosition && view.getFirstVisiblePosition() == 0) { isScrollDown = true; firstPosition = -1; rlSearch.setVisibility(View.VISIBLE); return false; } if (event.getRawY() < firstPosition) { isScrollDown = false; firstPosition = -1; rlSearch.setVisibility(View.GONE); return false; } return false; } }); } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } }); 
0
source

Source: https://habr.com/ru/post/897351/


All Articles