Reputation: 250
Is there a way to change navigations drawer icons' color? What I mean is that even I use a png that includes more than one color, the icon that drawn in the app has one color and I think default color is grey, can I make it colorful?
For example:
This is my png file that I want to use for icon but when I use it as navigation drawer items' icon it drawn like that:
Upvotes: 1
Views: 2720
Reputation: 1121
Changing icons INSIDE navigation drawer:
You can easily specify color in your navigation view XML:
Just add the desired color in itemIconTint property.
<android.support.design.widget.NavigationView
...
app:itemIconTint="#000000" //choose your color here.....
...
/>
Changing navigation drawer icon color (clicking which the drawer opens):
Set the theme:
<style name="MyDrawerArrowTheme" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="color">@android:color/white</item>
</style>
And add this custom theme in your application theme:
<item name="drawerArrowStyle">@style/MyDrawerArrowTheme</item>
Upvotes: 0
Reputation: 3325
set
navigationView.setItemIconTintList(null);
in your onCreate()
using this you can set different color icon of navigationdrawer.
Upvotes: 6