Code example for Paint

Methods: getTextBounds

0
	} 
 
    // Draw text aligned correctly. 
	private void drawText(Canvas canvas, int i, String text, Paint p, boolean left){
		Rect bounds = new Rect();
		p.getTextBounds(text, 0, text.length(), bounds);
		float textHeight = p.getFontMetrics().bottom - p.getFontMetrics().top;
		 
		float y = (float) (height/2.0 - (float)i * textHeight * 1.2f - textHeight*.2); 
		 
		 
		canvas.drawText(text, (float)(-width/2.0 + textHeight*.2f), y, p);
		 
		 
	} 
 
	 
	private void drawGrid(Canvas canvas) {
		for(int vertical = 1; vertical<10; vertical++){
	    	canvas.drawLine(
	    			vertical*(width/10)+1, 1,