android 测量字体宽度

float center_frame = (float) (getWidth() / 2.0);
float text_width = text_paint.measureText(camera_bottom_text);
double text_center = text_width / 2.0;
double textStartX = center_frame - text_center;
canvas.drawText(camera_bottom_text, (float) textStartX,
       frame.bottom + notice_text_margin_top, text_paint);


你可能感兴趣的:(android 测量字体宽度)