Rect rect = new Rect();
mTextPaint.getTextBounds(mText, 0, mText.length(), rect);
int x = getWidth() / 2 - rect.width() / 2;
canvas.drawText(mText, x, getHeight() / 2 + getBaseline(mTextPaint), mTextPaint);
//画矩形
//矩形距离坐标原点(0,0)的距离,左上角是原点,向右,下是正方向
//Rectf rectF = new RectF(left,top,right,bottom)
RectF rectF = new RectF(800, 100, 900, 200)
canvas.drawRect(rectF, paint)
canvas.drawArc(rectF, 135, 270, false, mOutPaint);
canvas.save();
canvas.clipRect(left, top, right, heigth);
canvas.drawText(mText, getWidth() / 2 - bounds.width() / 2, getHeight() / 2 + baseline, paint);
canvas.restore();