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
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"/>
2
Answers
You can simply use
foreground
for yourView
to achieve clickable effect:It should be like this:
We just have to add this line to the
View
to show ripple effect when it is clicked.try add this line to your XML