Floating Action Button Icon not centered inside

前端 未结 8 2473
鱼传尺愫
鱼传尺愫 2021-01-02 13:07

I\'m trying to use a FAB but the icon inside is placing at bottom right of the button:

FAB with icon not centered

This is the FAB definition in the xml:

8条回答
  •  醉梦人生
    2021-01-02 13:18

    This seems to be a bug in the Design Support Library v28.0.0.

    I could workarround this by setting the scaleType programmatically.

    In your case in the Java/Kotlin Code:

    centerLocationButton.setScaleType(ImageView.ScaleType.CENTER)
    

提交回复
热议问题