Search code examples
androidsearch-suggestionsearch-boxgoogle-books

How to put a custom button into a search suggestions menu?


I searched on the web but found no help regarding this. I would like to put a custom "Advanced Search" button into search suggestions that would guide the user to another activity/fragment. I have a screenshot of it implemented in Google Books app: Google books example

Does anybody know how to implement it?


Solution

  • The easiest way would be to add a view below the search bar and just change the visibility.

    Another way would be to use an AutoCompleteTextView: https://developer.android.com/reference/android/widget/AutoCompleteTextView.html then use something like this to check which was chosen: AutoCompleteTextView detect if user choosed suggestion

    Otherwise, adding a menu button on the side would be a nice alternative.