Change color buttons of the AppBar on Android


How to change the color of the buttons of the AppBar ?, in my case of the return button, the default color is white

But mine turns black and I want to change it to white try it with the accent colors and even then it does not change me.

asked by Gunnar 29.03.2016 в 00:18

3 answers


Do it programmatically:

final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
upArrow.setColorFilter(Color.parseColor("#FFFFFF"), PorterDuff.Mode.SRC_ATOP);

As of API 23 it went from abc_ic_ab_back_mtrl_am_alpha to abc_ic_ab_back_material

answered by 29.03.2016 / 00:33

With the following function you can apply to any icon of AppBar

public static void tintMenuItemIcon(Context context, Menu menu, int idItem, int color) {
    Drawable drawable = menu.findItem(idItem).getIcon();

    drawable = DrawableCompat.wrap(drawable);
    DrawableCompat.setTint(drawable,color ); 


It is recommended to change the color of menu items within AppBar in onCreateOptionsMenu

public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(, menu);

    GeneralUtils.tintMenuItemIcon(getActivity(), menu,, Color.WHITE);
    GeneralUtils.tintMenuItemIcon(getActivity(), menu,, Color.WHITE);

    super.onCreateOptionsMenu(menu, inflater);
answered by 15.10.2016 в 19:46

A solution without java code is to modify the stylo xml.

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

If you have it in Light, the button on the back colors it black, but with DarkActionBar it colors it white

answered by 25.07.2017 в 03:52