Android: Floating Button Icon is not centred

Solution 1:

I have faced the same problem. the following solution have worked for me

app:fabCustomSize="40dp"

Solution 2:

You should set fabCustomSize value like FAB exactly size:

<android.support.design.widget.FloatingActionButton
        android:layout_width="60dp"
        android:layout_height="60dp"
        app:fabCustomSize="60dp"
        android:src="@drawable/plus_icon"
        app:rippleColor="@color/colorPrimaryDark" />

Solution 3:

I just set the app:fabCustomSize=”40dp” (needed size) and I set the height and width as wrap_content then issue solved

Solution 4:

Reason is your image is not in the right size!!

Floating action button default circle size is 56 x 56dp , to get the best fit use that for your background image!!

If you are going for a mini one should be : 40 x 40dp

If you only want to change the Interior icon(only icon) use a 24 x 24dp icon for default size

To test this again i download an image form internet and scaled it down to 56dp and kept a small space to balance it (i am no good with Photoshop)

enter image description here

and added this to your FB view and made background yellow to make it clear.Let's see

out put:

enter image description here

This means it depends on the image that you add and its size if you want to go full background you can even use an imageButton

Refer : https://material.io/guidelines/components/buttons-floating-action-button.html#buttons-floating-action-button-floating-action-button