質問

i have the ListView. I need hide header, it'll be search panel (simple layout with edit text). Concretely: opened fragment with a listview, header (search panel) not visible, fill listview, if user scroll listview to the top - header showed. Something like PullToRefresh.

I tried add header to ListView#addHeaderView() and use setSelection(1), but if listview contains few rows, header showed whatever.

How can i make desired functionality?

役に立ちましたか?

解決

You could try that with:

myListView.setOnScrollListener(new AbsListView.OnScrollListener() {
    @Override
    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
        myHeaderElement.setVisibility(View.GONE);
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top