Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change AppCompat SearchView suggestion background

I want to set the background of the dropdown suggestions of the SearchView in my Theme style. I don't want to do this via layout files, because I want the OS to handle the selection backgrounds themselves. Setting the background programmatically removed list selectors, and I want to avoid that.

example

This is what I have right now. I want the background of the rows to be white. What do I have to change in my styles.xml to achieve that?

PS: i removed the text on the suggestions myself, so it looks like a big dark block.

like image 640
tolgap Avatar asked Feb 22 '15 19:02

tolgap


1 Answers

The SearchView has its popup based on a standard styled AutoCompleteTextView so you could change the standard style for this widget in your custom theme to obtain the background change. So in the custom theme override the autoCompleteTextViewStyle attribute to point to a new style in which you have to override the popupBackground with the desired background.

like image 75
user Avatar answered Nov 01 '22 22:11

user