Android FloatingActionButton Ripple Doesn't Work Properly

142 Views Asked by At

My problem is, when I press my FloatingActionButton the ripple appears on the border (almost can't see) not the center.

This is my custom style:

<style name="myFloatingActionButton" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="colorAccent">@android:color/white</item>
</style>

And this is my FloatingActionButton:

<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@+id/main_close_floatingActionButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="16dp"
    android:backgroundTint="@android:color/transparent"             //transparent background
    android:src="@drawable/close"
    android:theme="@style/myFloatingActionButton"                   //apply custom style
    app:elevation="0dp"                                             //remove default shadow
    app:fabSize="mini"                                              //adjust size
    app:hoveredFocusedTranslationZ="0dp"                            //remove default clicking effect
    app:pressedTranslationZ="0dp" />                                //remove default hover effect

Any help will be appreciated.

1

There are 1 best solutions below

0
Kevin Paul Montealegre Melo On

Try the following attribute, but remember that it must be inside a viewgroup of type coordinatorlayout

                android:layout_gravity="bottom|right"