Sid
Sid

Reputation: 1270

Why does my FloatingActionButton have ripple effect even in resting state?

I don't know why there is a ripple effect even in the resting state of my FAB(FloatingActionButton). This is how it looks: Inappropriate FAB

This is my implementation in xml:

<android.support.design.widget.FloatingActionButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="16dp"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:src="@drawable/white_plus"
    android:id="@+id/plusIcon"
    android:padding="0dp"
    app:pressedTranslationZ="12dp"
    app:elevation="6dp"
    app:paddingEnd="0dp"
    app:paddingStart="0dp"
    android:clickable="true"/>

Upvotes: 1

Views: 1039

Answers (2)

Aleksandr Kurdadze
Aleksandr Kurdadze

Reputation: 11

In addition to Sid's answer, you can also call

android:alpha = "0.8" 

directly in XML.

Upvotes: 1

Sid
Sid

Reputation: 1270

This problem was coming because I had set the colorAccent to #af18cccc and, hence, it was not completely opaque. After changing the colorAccent to #ff18cccc, it was working perfectly. For bringing the transparency effect, I called setAlpha(0.8) from the java code. Now, it works like a charm! :)

Upvotes: 1

Related Questions