change color of vector icons code example

Example: vector icon color always black

you are trying to add a icon that has different colours to a FAB?
When doing that, make sure you add app:tint="@null". In your case the xml should look like this:

<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
    android:id="@+id/floating_btn_take_test"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|center"
    android:layout_marginBottom="@dimen/dimen_20dp"
    android:text="@string/txt_take_test"
    android:textColor="@color/primaryColor"
    app:backgroundTint="@color/color_white"
    app:elevation="@dimen/dimen_10dp"
    app:icon="@drawable/ic_color_icon"
    app:layout_anchorGravity="bottom|center"
    app:rippleColor="@color/secondaryColor"
    app:shapeAppearanceOverlay="@style/ShapeAppearance_Button"
    app:tint="@null" />

Tags:

Misc Example