I would like to know how to style the drop down popup of the Android 4.0 SearchView
?
I'm using the Theme.Sherlock.Light.DarkActionBar
, but I don't know how to style the drop down search into a white background and a black text?
I would like to know how to style the drop down popup of the Android 4.0 SearchView
?
I'm using the Theme.Sherlock.Light.DarkActionBar
, but I don't know how to style the drop down search into a white background and a black text?
For some reason theming using the "searchAutoCompleteTextView" wasn't working for me either. So I solved it using the following code when setting up my SearchView:
Note: This is all done with the android v7 support/AppCompat library
There are two search drop down resources provided by the compatibility library, they are
There're multiple steps of doing so
Firstly, you need to create a custom drawable with four states, you can refer to {ABSLibrary}/res/drawable/abs__list_selector_holo_dark.xml. It will be something like this :
Save the custom drawable above (.xml format) into your own project res/drawable. Edit the styles accordingly by referring the sample above. Please note that the style might be deeply nested, just be patience looking down the tree.
Then create (or put into existing custom theme) a custom theme with the following, it should be saved as res/values/styles.xml:
Please note that the "myCustomDrawable_DropDown" and "myCustomDrawable_popupBackground" has to be the name of the custom drawable which you have just created.
You just have to know that the "android:dropDownSelector" and/or "android:popupBackground" are those who are responsible for the theming of the autocomplete popup box.
Finally, apply the theme in your Manifest!