azuosxela
azuosxela

Reputation: 250

Android Navigation Drawer Icons' Color

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:

My png file that I want to use for icon

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:

enter image description here

Upvotes: 1

Views: 2720

Answers (2)

DsD
DsD

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

Aman Verma
Aman Verma

Reputation: 3325

set

navigationView.setItemIconTintList(null);

in your onCreate()

using this you can set different color icon of navigationdrawer.

Upvotes: 6

Related Questions