The new default Navigation Drawer Activity template in Android Studio
defines its titles and icons in a menu file activity_main_drawer
like this:
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_camara"
android:icon="@drawable/ic_action_emo_cool"
android:title="Import" />
<item
android:id="@+id/nav_gallery"
android:icon="@android:drawable/ic_menu_gallery"
android:title="Gallery" />
<item
android:id="@+id/nav_slideshow"
android:icon="@android:drawable/ic_menu_slideshow"
android:title="Slideshow" />
...
The first item in my example uses a red icon:
but when I run the app, the color of the icon remains black.I have tested this for blue, green, yellow and purple icons, but the result is the same.
I read somewhere that the toolbar should use ThemeOverlay.AppCompat.Dark.ActionBar
and my app already uses this in the styles.xml
file:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
Initially I thought this had something to do with Android Studio's cache feature so I invalidated cache and restarted Android Studio with no luck.
app:itemIconTint="@android:color/blue"
to yournavigation View
– M D