Reputation: 694
I have a ListView over the whole screen of the application. To search for list items, I want an input field on the top of the ListView, but it should only become visible if the ListView is scrolled down (like the search field in the email application of the iPhone).
Because it is a ListView I can't create a cell with an input field (other field type like the other cells) in it. I would be glad if someone can give a hint with which technic I can do it. Thx.
Upvotes: 0
Views: 1653
Reputation: 256
Add a layout above the listview to put in your search edit text (in a linear layout or a frame layout with padding for the list view).
Alternately you could use one of the Design Support Library components and it will be even more well integrated. Then call from your layout to filter the ListView adapter components, ideally with a text watcher or listener that is added to the edit text.
Upvotes: 1
Reputation: 3026
I think you should have a look at SearchView widget :
https://developer.android.com/reference/android/widget/SearchView.html
You try using a SearchView with a ListView. Tutorial link :
http://www.coderzheaven.com/2013/06/01/create-searchview-filter-mode-listview-android/
If you want to hide this then probably make this action menu as invisible and invalidate the options menu and set the visibility true to make it visible on list scroll.
Upvotes: 1
Reputation: 8978
I'd suppose to use material-design pattern with scrollable navigation bar. There is common template of an application for that purpose in Android Studio
Upvotes: 1