-2

I have a problem with changing the FAB background color, it seems that the FAB have another background behind it

here my code

<FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="@dimen/fab_margin"
    app:layout_anchor="@id/app_bar"
    app:layout_anchorGravity="bottom|end">

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab"
        android:layout_margin="20dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:backgroundTint="@color/colorPrimary"
        android:src="@android:color/transparent" />

    <TextView
        android:id="@+id/text_vote"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="@android:string/ok"
        android:elevation="16dp"
        android:includeFontPadding="false"
        android:textColor="@android:color/white"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</FrameLayout>

enter image description here

I would like to remove the purple/pink color behind it. right now the only solution that works is changing the colorAccent on my app, but it will affect other UI element

ankuranurag2
  • 2,300
  • 15
  • 30

3 Answers3

3

Try This Code: i have add this line in FloatingActionButton

app:backgroundTint="#000"

to change FloatingActionButton background

Code

 <android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    app:backgroundTint="#000"
    app:srcCompat="@android:drawable/ic_dialog_email" />

I hope it Work for you

Android Geek
  • 8,956
  • 2
  • 21
  • 35
0

you can do like below android:backgroundTint="@color/pink"

Ashok Reddy M
  • 330
  • 3
  • 9
0

Just add this:

app:borderWidth="0dp"
Sam Chen
  • 7,597
  • 2
  • 40
  • 73