PhialButton.java 文件源码

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

项目:Phial 作者:
@Override
protected void onDraw(Canvas canvas) {
    int w = getWidth();
    int h = getHeight();

    int cx = w / 2;
    int cy = (int) (h / 2f - getShadowDy());

    int radius = (int) (Math.min(w, h) / 2f - shadowSize);

    canvas.drawCircle(cx, cy, radius, bgPaint);

    if (icon != null) {
        final int targetW = getIconSize(2 * radius, icon.getIntrinsicWidth());
        final int targetH = getIconSize(2 * radius, icon.getIntrinsicHeight());
        icon.setBounds(cx - targetW / 2, cy - targetH / 2, cx + targetW / 2, cy + targetH / 2);
        icon.draw(canvas);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号