Android Design Library - Floating Action Button Padding/Margin Issues

后端 未结 7 2191
梦毁少年i
梦毁少年i 2020-12-02 05:14

I\'m using the new FloatingActionButton from the Google Design Library and I am getting some strange padding/margin problems. This image (with developer layout options on) i

7条回答
  •  無奈伤痛
    2020-12-02 05:57

    No more fiddling with styles.xml or with .java files. Let me make it simple.

    You can use app:useCompatPadding="true" and remove custom margins to maintain same margins across different versions of android

    The extra margin/padding you saw on the FAB in your second picture is due to this compatPadding on pre-lollipop devices. If this property is not set, it gets applied on pre-lollopop devices and NOT in lollipop+ devices.

    Proof of concept

提交回复
热议问题