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);
相關文章
相關標籤/搜索