I want to use SearchView in my project, but I have a problem with elements' color. Let me show you: its fragmentDialog where I have my SearchView
I dont need to change bg color. The next picture is for example. I want to see SearchView elements without black bg.
I have tried to
but nothing is working. The search icon and anoter elements still white. Maybe I'm losing something? Can I do this in XML? Please, help me.
In this answer I assume that, the SearchView
is added inside Toolbar
and AppTheme
is a child of Theme.AppCompat.Light.NoActionBar
<style name="AppTheme.Toolbar" parent="AppTheme">
<!--This line changes the color of text in Toolbar-->
<item name="android:textColorPrimary">@color/green</item>
<!--This line changes the color of icons in toolbar (back, overflow menu icons)-->
<item name="android:textColorSecondary">@color/green</item>
</style>
Now use the AppTheme.Toolbar
as your toolbar's theme.
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:theme="@style/AppTheme.Toolbar" />