Skip to content

Commit

Permalink
绘制居中文字逻辑修改
Browse files Browse the repository at this point in the history
  • Loading branch information
alidili committed Dec 28, 2017
1 parent c307297 commit 9cdde7a
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ public void draw(Canvas canvas) {
/*paint.setTextSize(sp2px(50));
paint.setColor(Color.GRAY);
// 文字宽
float textWidth = paint.measureText("YangLe'Blog");
// 文字高
float textHeight = Math.abs(fontMetrics.ascent + fontMetrics.descent);
canvas.drawText("YangLe'Blog", -textWidth / 2, textHeight / 2, paint);*/
float textWidth = paint.measureText("YangLe");
// 文字baseline在y轴方向的位置
float baseLineY = Math.abs(paint.ascent() + paint.descent()) / 2;
canvas.drawText("YangLe", -textWidth / 2, baseLineY, paint);*/
}

/**
Expand Down

0 comments on commit 9cdde7a

Please sign in to comment.