简体   繁体   中英

Android - SearchView and overflow MenuItem icon colors

My toolbar icons are all black, except the SearchView and overflow (three dots) icon, which are what appear to be a dark grey color.

在此处输入图片说明

Is there a way to set the tint of these icons to black to match my other icons?

Here's the theme I use, but as far as I know it's nothing out of the ordinary.

<!-- Base application theme. -->
<style name="Theme.AnglersLog" parent="Base.Theme.AnglersLog">

</style>

<style name="Base.Theme.AnglersLog" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:logo">@android:color/transparent</item>

    <item name="colorPrimary">@color/anglers_log_light</item>
    <item name="colorPrimaryDark">@color/anglers_log_dark</item>
    <item name="colorAccent">@color/anglers_log_accent</item>

    <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
</style>

And toolbar

<android.support.design.widget.AppBarLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize"
        android:background="@color/anglers_log_light"/>

</android.support.design.widget.AppBarLayout>

Thanks!

You need to add the theme to the AppBarLayout and the Toolbar like this:

<android.support.design.widget.AppBarLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" 
    android:theme="@style/ThemeOverlay.AppCompat.ActionBar" >

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize"
        android:background="@color/colorAccent"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

</android.support.design.widget.AppBarLayout>

Or if you want a dark theme:

<android.support.design.widget.AppBarLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" 
    android:theme="@style/@style/ThemeOverlay.AppCompat.Dark.ActionBar" >

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize"
        android:background="@color/colorAccent"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat" />

</android.support.design.widget.AppBarLayout>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM