Slice.java 文件源码

java
阅读 38 收藏 0 点赞 0 评论 0

项目:Slice 作者:
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void setRipple(final int mask) {
    if (SDK_LOLLIPOP) {
        if (mask != 0) {
            ShapeDrawable shape = new ShapeDrawable(new Shape() {
                @Override
                public void draw(Canvas canvas, Paint paint) {
                    paint.setColor(mask);
                    canvas.drawPath(((CustomRoundRectDrawable) drawable).buildConvexPath(), paint);
                }
            });

            RippleDrawable ripple = new RippleDrawable(buildColorStateList(mask), drawable, shape);
            view.setBackground(ripple);
        } else {
            view.setBackground(drawable);
        }
    } else {
        Log.i(TAG, "setRipple() only work for API 21+");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号