Android search list while typing

后端 未结 5 982
名媛妹妹
名媛妹妹 2020-12-04 15:06

How can I build a search bar where while I\'m typing the results are shown in the ListView in which I\'m searching?

For example, I have a list view with

5条回答
  •  情歌与酒
    2020-12-04 15:27

    The best way is to use the built in search bar or SearchManager by overriding onSearchRequested in a searchable activity. You can set a datasource to search on to get the automatic drop down of results or you can just take in the input from the user and search after. Here is a good overview of SearchManager is a Plus there is a working demo in the API Demos project com.example.android.apis.app.SearchQueryResult

    @Override
    public boolean onSearchRequested() {
    

提交回复
热议问题