Skip to content Skip to sidebar Skip to footer

How To Remove Auto Padding Of Fab Button In Android?

I am using FAB button for profile picture but it is already having some padding. I am using following code for creating FAB button.

Solution 1:

just add this in your dimens.xml file

<dimenname="design_fab_image_size"tools:override="true">36dp</dimen>

This might not work for 3rd party libraries.

Solution 2:

You can changethe attribute app:maxImageSize to match the size of your image.

app:maxImageSize="the wanted size"

I find the solution safer the the overriding of the design_fab_image_size because if your app have several floating action buttons, you will only alter one.

Solution 3:

add this in your fab xml layout

android:elevation="0dp"app:elevation="10dp"app:useCompatPadding="true"

This will do the job. Worked perfectly for me.

Solution 4:

Just Add

app:useCompatPadding="false"

Post a Comment for "How To Remove Auto Padding Of Fab Button In Android?"