2016-04-25 15 views
0

Ich versuche Überlaufmenü Symbolfarbe der Symbolleiste zu ändern, die wie folgt lautet: -Überlauf Menüsymbol Farbe wird nicht für Android ändern <21

<android.support.v7.widget.Toolbar 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/toolbar_actionbar" 
    android:layout_width="match_parent" 
    android:layout_height="?attr/actionBarSize" 
    app:layout_scrollFlags="scroll|enterAlways" 
    app:popupTheme="@style/CustomPopup" 
    app:theme="@style/MyCustomToolBarTheme">  
</android.support.v7.widget.Toolbar> 

Die beiden speziellen Wünsche erfüllen: -

<style name="MyCustomToolBarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar"> 
     <item name="android:textColorSecondary">@android:color/white</item> 
</style> 
<style name="CustomPopup" parent="ThemeOverlay.AppCompat.Light"> 
     <item name="android:textColorSecondary">@android:color/white</item> 
</style> 

Ich kann Titel/Menü Symbolfarbe auch ändern. Aber das Überlaufsymbol Farbe ist immer schwarz.Ich habe sogar versucht, benutzerdefinierte Symbol, das auch nicht funktioniert.

+0

Die Symbolfarbe wird durch 'colorControlNormal' definiert, also überschreiben Sie diese. (Es zeigt auf 'android: textColorPrimary' in dunklen Themen und' android: textColorSecondary' in hellen Themen.) –

Antwort

0

Ich habe das Problem gelöst, indem ich das Überlaufsymbol durch eines meiner eigenen ersetzt und die Farbe selbst eingestellt habe.

<style name="AppTheme" parent="Theme.AppCompat.NoActionBar"> 
<!-- Customize your theme here. --> 
<item name="actionOverflowButtonStyle">@style/OverflowMenuButton</item> 
</style> 


<style name="OverflowMenuButton" parent="Theme.AppCompat.NoActionBar" > 
    <item name="android:src">@drawable/overflow</item> 
</style> 
+0

Ich habe versucht, das Symbol auf die gleiche Weise zu ändern, aber es hat nicht funktioniert –

1

können Sie versuchen, die nächste:

public static void setOverflowButtonColor(final Toolbar toolbar, final int color) { 
    Drawable drawable = toolbar.getOverflowIcon(); 
    if(drawable != null) { 
     drawable = DrawableCompat.wrap(drawable); 
     DrawableCompat.setTint(drawable.mutate(), color); 
     toolbar.setOverflowIcon(drawable); 
    } 
} 
0

Ihre Eltern Wechsel von "ThemeOverlay.AppCompat.Light" auf "Theme.AppCompat.Light".

<style name="ToolbarOverflow" parent="Theme.AppCompat.Light"> 
    <item name="android:textColorSecondary">@color/white</item> 
</style>