How to remove border/shadow from lollipop buttons

前端 未结 11 1520
借酒劲吻你
借酒劲吻你 2020-12-12 19:21

The buttons looks fine for api < 21. However, the +21 versions creates this border or shadow that is shown on the image below. How do I get rid of it without changeing th

11条回答
  •  温柔的废话
    2020-12-12 19:48

    Lollipop has a nasty little feature called stateListAnimator which handles the elevations on Buttons, which leads to shadows.

    Remove the stateListAnimator to get rid of the shadows.

    You have got multiple options to do that:

    Java:

    button.setStateListAnimator(null);
    

    Kotlin:

    button.stateListAnimator = null
    

    or in your layout xml's:

提交回复
热议问题