Changing the background color of searchview autocomplete dropdown
android, searchview, styles
Solution
Applying styles you can change the dropdown background color and the items text color and size
<!-- ToolBar -->
<style name="ToolBarStyle" parent="Theme.AppCompat">
<item name="android:textColorPrimary">@android:color/white</item>
<item name="android:textColorSecondary">@android:color/white</item>
<item name="actionMenuTextColor">@android:color/white</item>
<item name="android:dropDownItemStyle">@style/myDropDownItemStyle</item>
<item name="android:dropDownListViewStyle">@style/myDropDownListViewStyle</item>
</style>
<style name="myDropDownItemStyle" parent="Widget.AppCompat.DropDownItem.Spinner">
<item name="android:textColor">@color/secondary_text_default_material_light</item>
<item name="android:textSize">14dp</item>
</style>
<style name="myDropDownListViewStyle" parent="Widget.AppCompat.ListView.DropDown">
<item name="android:background">#FFF</item>
</style>
Problem
I have a searchview with a content provider for custom suggestions, which are displayed in a dropdown. However, the dropdown background is dark while the text is black so it's not very visible. My app theme is inheriting from Theme.AppCompat.Light so everything else in my app is black text on a light background. I want to change the background of the dropdown so the text is readable but I haven't found any way of doing so. The closest I got was following the solution here: Style Android SearchView Drop down popup But when the dropdown appears, stuff looks messed up. Is there any working solution for this?