Home > Net >  Vector asset color is not getting reflected when using it over FAB
Vector asset color is not getting reflected when using it over FAB

Time:01-02

alright, basically i created a floating action button (FAB) and wanted to put a vector asset on it, when i created it i selected the color white for it, but for some reason i dont undertand its getting reflected as black when its implemented...

im using constraint layout and this is my FAB:

<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@ id/fab_flecha_avanzar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="16dp"
    android:backgroundTint="@color/rojo_normal"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/poner_contrasena_again"
    app:layout_constraintHorizontal_bias="0.95"
    android:src="@drawable/vector_asset_flecha_avanzar"
    />

this is my Vector Asset:

<vector android:autoMirrored="true" android:height="40dp"
    android:tint="#FFFFFF" android:viewportHeight="24"
    android:viewportWidth="24" android:width="40dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="@android:color/white" android:pathData="M12,4l-1.41,1.41L16.17,11H4v2h12.17l-5.58,5.59L12,20l8,-8z"/>
</vector>

this is the output im getting: image here

i have tried the attributes android:tint, but tbh i have no idea whats going on, never happened this before and couldn't find a similar problem online

CodePudding user response:

app:tint="#FFFFFF"

Add the above line to your floating action button XML code. It will override the default black tint of the vector asset to whatever color you pass in it.

  • Related