Android: Floating Button Icon is not centred

后端 未结 9 2354
忘了有多久
忘了有多久 2020-12-10 00:53

I\'m trying to create a floating button in my app. The button is there, but the image in the button is a bit upwards (see image).

I can\'t figure out what\

9条回答
  •  天涯浪人
    2020-12-10 01:22

    This usually arises when using custom-sized floating action button(FAB), because android by default, only supports 40dp FAB. The best way is to override it, by telling your view that you are using a custom sized FAB, and give the same size as value to it too.

    For example, while using a 60dp x 60dp FAB, this will do the trick.

    app:fabCustomSize="60dp"

提交回复
热议问题