Home > Mobile >  How to give ripple effect above Src image in FAB
How to give ripple effect above Src image in FAB

Time:11-03

I am working with FAB in android and I have increased the Src image size to cover the FAB but now whenever I click on FAB the ripple effect is shown behind the image instead of above it, which doesn't give a feel that FAB is clicked

enter image description here

My FAB code

    <com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@ id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:maxImageSize="@dimen/_130sdp"
    android:layout_gravity="center|bottom"
    android:contentDescription="@string/app_name"
    app:srcCompat="@drawable/ic_radial_gradient"
    app:backgroundTint="@color/white"
    app:elevation="0dp"
    app:layout_anchor="@id/bottomAppBar"
    app:tint="@null"/>

CodePudding user response:

try add this line to your XML

android:foreground="?android:attr/selectableItemBackgroundBorderless"

CodePudding user response:

try add this line to your XML

android:foreground="?android:attr/selectableItemBackgroundBorderless"
  • Related