Android Floating Action Button Semi Transparent Background Color Android Floating Action Button Semi Transparent Background Color xml xml

Android Floating Action Button Semi Transparent Background Color


Got the same issue here.I tried to set alpha transparency in xml using backgroundTint but it didn't work and resulted in the same appearance as in your screenshots (two circles).

So I set it in code like this :

floatingButton = (FloatingActionButton) findViewById(R.id.fab);floatingButton.setAlpha(0.25f);

And the look is now consistent.


Set elevation and pressedTranslationZ zero to remove the effects

<android.support.design.widget.FloatingActionButton    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:onClick="onClickMyLocation"    app:backgroundTint="@color/transparentColor"    app:srcCompat="@drawable/ic_my_location"    app:elevation="0dp"    app:pressedTranslationZ="0dp"/>


Unless the elevation is necessary, you can remove the "inner circle" by setting it to 0:

app:elevation="0dp"

As @David notes in the comments, you may want to try 1dp if 0 does not work.