Floating action button's shadow clipping at view margins

后端 未结 5 2192
没有蜡笔的小新
没有蜡笔的小新 2021-01-03 21:53

I have a floating action button anchored to the bottom right of a coordinator layout. It is 16dp from the margins of the view (the margins are included by default and specif

5条回答
  •  爱一瞬间的悲伤
    2021-01-03 22:45

    The problem is a parent clipping the shadow. Look for the parent that is clipping the shadow (is not necessarily the next in the hierarchy) and add this to the view in the xml.

    android:clipChildren="false"
    

    I've been testing this right now removing and adding that line to the parent that was clipping the view and is working fine.

    Adding another containers or changing the margins is a workaround that I don't recommend. It's too patchy. The mini fabs have different container sizes and require different sizes depending on the API level (<21 or >=21).

提交回复
热议问题