Android Design Library - Floating Action Button Padding/Margin Issues

后端 未结 7 2214
梦毁少年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 06:02

    In layout file set attribute elevation to 0. because it takes default elevation.

    app:elevation="0dp"
    

    Now in activity check api level greater than 21 and set elevation if needed.

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        fabBtn.setElevation(10.0f);
    }
    

提交回复
热议问题