Examples of measureText()


Examples of android.graphics.Paint.measureText()

        Paint paint = new Paint();
        paint.setColor(Color.RED);
        paint.setTextSize(20);

        String s = "FacePreview - This side up.";
        float textWidth = paint.measureText(s);
        canvas.drawText(s, (getWidth()-textWidth)/2, 20, paint);

        if (faces != null) {
            paint.setStrokeWidth(2);
            paint.setStyle(Paint.Style.STROKE);
View Full Code Here

Examples of elemental.canvas.CanvasRenderingContext2D.measureText()

  @Override
  public double measureStringWidth(String text) {
    CanvasRenderingContext2D context = (CanvasRenderingContext2D) canvas.getContext("2d");
    context.setFont(calculator.getFont());
    TextMetrics metrics = context.measureText(text);
    return metrics.getWidth();
  }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.