How to remove auto padding of FAB button in android?

后端 未结 4 1705
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-04 09:44

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

相关标签:
4条回答
  • 2021-02-04 10:18

    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.

    0 讨论(0)
  • 2021-02-04 10:18

    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.

    0 讨论(0)
  • 2021-02-04 10:23

    Just Add

    app:useCompatPadding="false"
    
    0 讨论(0)
  • 2021-02-04 10:34

    just add this in your dimens.xml file

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

    This might not work for 3rd party libraries.

    0 讨论(0)
提交回复
热议问题