简体   繁体   中英

how to change the color of vector asset in FloatingActionButton?

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM