I have a SearchView in the main content area of my activity.
I need to override the SearchView style in my style.xml files (so I can remove the SearchView's underline - as shown here).
However, when I override the SearchView
style, its searchIcon
just disappears from the UI:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="searchViewStyle">@style/MySearchView</item>
<item name="android:searchViewStyle">@style/MySearchView</item>
</style>
<style name="MySearchView" parent="Widget.AppCompat.Light.SearchView">
<!-- nothing entered here yet! -->
</style>
I know I can specify my own drawable for the searchIcon
, but I would like to use the default one.
So how do I specify MySearchView
style without losing the default searchIcon
?
Update #1
I don't know if this is normal, but I also have a problem where if I override the Button style using this approach, then my buttons lose all their padding and therefore become too small:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="buttonStyle">@style/MyButton</item>
<item name="android:buttonStyle">@style/MyButton</item>
</style>
<style name="MyButton" parent="android:style/Widget.Button">
<item name="android:textColor">@color/white</item>
<item name="android:background">@color/red</item>
</style>