envyM6 envyM6 - 1 year ago 220
Android Question

Customising Default Navigation Drawer Activity Vector Icons

I'm trying to customise and colourise the default

Navigation Drawer Activity
on Android Studio 2.1.2. I've changed the color of
file in following way--

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:fillColor="#f73a3a" //changed colour
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
android:fillColor="#f73a3a" //changed colour
android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />

The colour changes in the preview window as per screenshot below-

enter image description here

However, colour is changed again to default black/dark grey when the app is launched--

enter image description here

How can I implement the changed color here?

Answer Source

You need to set the setItemIconTintList to null during onCreate


Now you can edit the vector assets directly and the changes will show.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download