跟web一样的阴影效果

231 阅读1分钟
原文链接: github.com

Android实现和web中一样的阴影效果

使用方式:

自定义view,并在onDraw中执行如下代码

 ShadowHelper.draw(canvas, this,
                Config.obtain()
                        .color(color)
                        .leftTopCorner((int) lt)
                        .rightTopCorner((int) rt)
                        .leftBottomCorner((int) lb)
                        .rightBottomCorner((int) rb)
                        .radius(radius)
                        .xOffset(xOffset)
                        .yOffset(yOffset)
        );

具体用法参考 RadiusView.java

效果

1 1 1