Home > Back-end >  how to change the color of vector asset in FloatingActionButton?
how to change the color of vector asset in FloatingActionButton?

Time:10-07

this is my FloatingActionButton

<com.google.android.material.floatingactionbutton.FloatingActionButton
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:backgroundTint="@color/white"
                    android:focusable="true"
                    android:src="@drawable/ic_camera_24"
                    android:tint="@color/green"
                    app:fabSize="mini"
                    app:rippleColor="@color/green" />

i tried to change color in layout ic_camera_24.xml but it still not work, how can i fix it?

have a nice day, everyone!

CodePudding user response:

try this with app:srcCompat and app:tint:

<com.google.android.material.floatingactionbutton.FloatingActionButton
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:backgroundTint="@color/white"
                    android:focusable="true"
                    app:srcCompat="@drawable/ic_camera_24"
                    app:tint="@color/green"
                    app:fabSize="mini"
                    app:rippleColor="@color/green" />

src: https://material.io/components/buttons-floating-action-button/android#mini-fabs

  • Related