Android drop shadow radius

75 views Asked by At

I'm working on to get a drop shadow.

The closest one I can get is to do with gradient-radius.

The code is as below:

<item>
        <shape android:shape="rectangle">
            <size android:height="84dp"
                android:width="84dp"/>
            <corners android:bottomRightRadius="40dip"
                android:bottomLeftRadius="40dip"
                android:topRightRadius="40dip"
                android:topLeftRadius="40dip"/>
            <gradient
                android:startColor="@color/black"
                android:endColor="@android:color/transparent"
                android:type="radial"
                android:gradientRadius="50%">
            </gradient>
        </shape>
    </item>

It works fine with Lollipop, but it doesn't work at all on API level 19. The image simply not show there.

Is there an alternative way to do so?

Thanks all.

1

There are 1 answers

0
GIGAMOLE On

Use my library. This effect u can draw only with canvas. https://github.com/GIGAMOLE/TintLayout