AutoCompleteTextView drop-down list highlighted according to search text

I applied AutoCompleteTextViewfor the search field in my application.

I want to highlight the text entered in AutoCompleteTextView(search text box), which will be highlighted in the drop-down list. How can i do this?

+4
source share
1 answer

So in your method getViewadd the following

Spannable spanText = Spannable.Factory.getInstance().newSpannable(textString);
spanText.setSpan(new BackgroundColorSpan(0xFFFFFF00), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
myTv.setText(spanText);
0
source

Source: https://habr.com/ru/post/1527454/


All Articles