I'm trying to do somethign very simple but yet I hadn't found anything in internet nor stackoverflow about how to solve it. I wanna change the menu icon color to match my other icons. How can I do it?. The setNavigationIcon
and setLogo
methods of Toolbar
doesnt work. Here is a screenshot of my current Toolbar
:
And here is my code that is executed in the onCreate
method.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_naviation_drawer);
mItems = getResources().getStringArray(R.array.nav_drawer_items);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawer.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START);
//For api-21 compatibility
if (mToolbar != null) {
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mDrawerToggle= new ActionBarDrawerToggle(this, mDrawer, mToolbar, R.string.app_name, R.string.app_name);
mDrawer.setDrawerListener(mDrawerToggle);
mToolbar.setNavigationIcon(R.drawable.ic_menu); //Doest work (is the white icon)
mToolbar.setLogo(R.drawable.ic_menu); //Doest work (is the white icon)
}
mToolbar.inflateMenu(R.menu.startup_navigation_drawer);
mContentViewAlreadySet = Boolean.TRUE;
mDrawerList = (ListView) findViewById(R.id.left_drawer);
// Set the adapter for the list view
mDrawerList.setAdapter(new ArrayAdapter<String>(this,
R.layout.drawer_list_item, mItems));
// Set the list's click listener
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
}
I don't care if I end overriding the menu icon animation when I click it, I just want it to match my other icons color.
UPDATE:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppTheme.Base" parent="Theme.AppCompat.Light">
<!--<item name="android:buttonStyle">@style/AppTheme.Buttons</item>-->
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="isFloatingWindow">false</item>
<!-- colorPrimary is used, for instance, for the default ActionBar
(but not Toolbar) background.
We specify the same color for the toolbar background in
toolbar.xml.. -->
<item name="colorPrimary">@color/colorPrimary</item>
<!-- colorPrimaryDark is used for the status bar (with the
battery, clock, etc). -->
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<!-- colorAccent is used as the default value for
colorControlActivated which is used to tint widgets. -->
<item name="colorAccent">@color/colorSecondary</item>
<item name="android:textColorPrimary">@color/colorSecondary</item>
</style>
<style name="AppTheme" parent="@style/_AppTheme"/>
<style name="_AppTheme" parent="AppTheme.Base">
<item name="android:editTextBackground">@drawable/apptheme_edit_text_holo_light</item>
<item name="android:textColorHighlight">#9980cbc4</item>
<item name="android:textSelectHandleLeft">@drawable/apptheme_text_select_handle_left</item>
<item name="android:textSelectHandleRight">@drawable/apptheme_text_select_handle_right</item>
<item name="android:textSelectHandle">@drawable/apptheme_text_select_handle_middle</item>
<item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextViewAppTheme</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/apptheme_btn_check_holo_light</item>
<item name="android:listChoiceIndicatorSingle">@drawable/apptheme_btn_radio_holo_light</item>
<item name="android:buttonStyle">@style/ButtonAppTheme</item>
<item name="android:imageButtonStyle">@style/ImageButtonAppTheme</item>
<item name="android:dropDownSpinnerStyle">@style/SpinnerAppTheme</item>
<item name="android:progressBarStyleHorizontal">@style/ProgressBarAppTheme</item>
<item name="android:seekBarStyle">@style/SeekBarAppTheme</item>
<item name="android:ratingBarStyleIndicator">@style/RatingBarBigAppTheme</item>
<item name="android:ratingBarStyleSmall">@style/RatingBarSmallAppTheme</item>
<item name="android:buttonStyleToggle">@style/ToggleAppTheme</item>
<item name="android:listChoiceBackgroundIndicator">@drawable/apptheme_list_selector_holo_light</item>
<item name="android:activatedBackgroundIndicator">@drawable/apptheme_activated_background_holo_light</item>
<item name="android:fastScrollThumbDrawable">@drawable/apptheme_fastscroll_thumb_holo</item>
</style>
</resources>