Android L FAB Button shadow

前端 未结 3 2007
名媛妹妹
名媛妹妹 2020-12-12 18:50

In the Material Design guidelines Google presented a new style of button, the FAB Button. I found instructions how to make it but I have trouble adding the shadow.

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-12 19:12

    The problem with the circular shadow can be easily solved without any tricks with Outline: just add these properties to the button in the XML layout (in addition to the custom background):

    android:elevation="5dp"
    android:stateListAnimator="@null"
    

    Although Android Studio may display it wrong in the layout preview, it works fine when launched on a device.

提交回复
热议问题