0

I have created a vector asset in my drawable folder and changed its color to #155724 in its xml file. But whenever I try to add this drawable to my button, my drawable always picks primaryColor which I have declared in my colors.xml file. Please note that I am using material-design library.

<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:tint="#155724" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="#155724" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z" /> </vector> 

This is how I am adding my drawable in my button:

<Button android:id="@+id/doneBtn" style="@style/Widget.MaterialComponents.Button.OutlinedButton.Icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/done" android:textColor="#155724" app:icon="@drawable/ic_baseline_check_circle_24" app:strokeColor="#155724" /> 

1 Answer 1

2

Add this attribute to the button as default attribute are colorPrimary enter image description here

app:iconTint="@color/yourColor" 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.