RoundImageView.java 文件源码

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

项目:MyRepository 作者:
@Override
protected void onDraw(Canvas canvas) {
    Log.e("TAG", "onDraw");
    if (getDrawable() == null) {
        return;
    }
    setUpShader();

    if (type == TYPE_ROUND) {
        canvas.drawRoundRect(mRoundRect, mBorderRadius, mBorderRadius,
                mBitmapPaint);
    } else if (type == TYPE_LEFT_ROUND) {
        float[] radii = {mBorderRadius, mBorderRadius, 0f, 0f, 0f, 0f, mBorderRadius, mBorderRadius};
        Path path = new Path();
        path.addRoundRect(mRoundRect, radii, Path.Direction.CW);
        canvas.drawPath(path, mBitmapPaint);
    } else {
        canvas.drawCircle(mRadius, mRadius, mRadius, mBitmapPaint);
        // drawSomeThing(canvas);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号