Search code examples
androidsearchviewandroid-search

How to increase the size of the text in suggestions in MaterialSearchView?


I've implemented MaterialSearchView in a fragment and it works fine. Now I want to increase the size of the text in suggestions. How can I do that? Thanks!

enter image description here


Solution

  • I am not sure if the developers/contributors of this lib has provided an way to do this without the need to fork and edit the lib.

    Anyway, for me the easiest way to do what I want is to edit the lib. for your case, if you want edit the text attributes of the textview of suggestions, you may fork the lib and edit the layout named suggest_item as it is the layout used by the adapter that shows the suggestions.

    Links this and this


    if this does not suit you, you can always add new issue and/or question to the developers/contributors of the lib on the their repo's issue tracker on github, follow this link


    EDIT: for your question in comments on how to handle click on suggestions:

    The developers/contributors of the lib has provided a public method that you can use to add a click listener, it is named setOnItemClickListener

    See this for full method code