Button.java 文件源码

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

项目:Buttons 作者:
@Nullable
private Bitmap getRipple() {
    if (getBackground() == null || getWidth() < 1 || getHeight() < 1)
        return null;

    Bitmap bitmap;
    try {
        bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
    } catch (OutOfMemoryError e) {
        return null;
    }

    Canvas canvas = new Canvas(bitmap);

    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setColor(this.paint.getColor());
    paint.setAlpha(255);

    getBackground().draw(canvas);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP));
    canvas.drawCircle(rippleX, rippleY, progress * (getWidth() / 1.5f), paint);

    return bitmap;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号