Quantcast
Channel: Active questions tagged listview - Stack Overflow
Viewing all articles
Browse latest Browse all 611

Hide/show search layout on listview scroll

$
0
0

I have made a search layout above listview and I want to hide/show this search layout on listview scroll like on scrolling the facebook newsfeed show/hide the search bar on the top of news feed I have attached the my screenshot please see the screenshot and guide me about this. Thanks

screen shot of the view

Here is my listview scroll listener - in this I have tried but this is not what I want. I want something like facbook newsfeed as I told earlier.

@Overridepublic void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {    if (userScrolled && firstVisibleItem + visibleItemCount+1 == totalItemCount+1) {        userScrolled = false;        if (nextPage)            updateListView();    }}@Overridepublic void onScrollStateChanged(AbsListView view, int scrollState) {    int position = businessList.getFirstVisiblePosition();    View v = businessList.getChildAt(0);    int offset = (v == null) ? 0 : v.getTop();    if (mPosition < position || (mPosition == position && mOffset < offset)){        // Scrolled up        searchlayout.setVisibility(View.GONE);    } else {        // Scrolled down        searchlayout.setVisibility(View.VISIBLE);    }    if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {        userScrolled = true;        //linearlayout.setVisibility(View.GONE);    }}

Viewing all articles
Browse latest Browse all 611

Trending Articles