Elevation shadow is clipped

Complete answer

Add these 2 line to the parent view

android:clipChildren="false"

android:clipToPadding="false"

EXAMPLE:

<androidx.constraintlayout.widget.ConstraintLayout
            android:clipChildren="false"
            android:clipToPadding="false"
           ... >

        <TextView
         style="@style/TextShadowStyle"
          ....
            />

Text Shadow Style:

 <style name="TextShadowStyle">
        <item name="android:shadowColor">@color/black</item>
        <item name="android:shadowDx">10</item>
        <item name="android:shadowDy">10</item>
        <item name="android:shadowRadius">5</item>
    </style>

Your shadows may be getting clipped by the View's bounds. Try adding padding to the bottom of the button.

If the button sits at the bottom of the parent, the parent ViewGroup may also be clipping the shadow. Make sure the parent has padding and set android:clipToPadding="false"on the parent.


Add android:clipChildren="false" and android:clipToPadding="false" to button two ancestors ViewGroup.

Tags:

Xml

Android