Reputation: 13
I'm trying to have icons in a navigation drawer for my app in android studio and they keep on becoming grey when I have them as a different color.
I tried to use colored PNG files imported as drawables and they get turned grey in the app. I've tried to use the android studio clipart icons and set the color I want but they still are grey in the app.
I presume this is some issue with my styling/themes but I don't know how to fix this.
How do I get these icons to stay as the color I want?
colored PNG files
grey in the app
Upvotes: 1
Views: 407
Reputation: 251
you need to add this line in your activity_main.xml:
app:itemIconTint="@color/my_desired_colour"
to NavigationView (it is located in activity_main.xml layout file) The default tint is black but you can use an even darker shade of black by using #000000
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:itemIconTint="#000000"
app:menu="@menu/activity_main_drawer" />
Upvotes: 1
Reputation: 1875
You need to add below line in your NavigationView tag in xml file -
app:itemIconTint="@color/custom_color"
Upvotes: 0