Code example for TextPaint

Methods: setARGB, setTextSize

0
	 
	/** 
	 * textView的换行处理... 
	 * */ 
	private void textSplit(){ 
		TextPaint textPaint = new TextPaint();
 
		textPaint.setARGB(0xFF, 0xFF, 0, 0);
		textPaint.setTextSize(20.0F);
		String aboutTheGame = "关于本游戏:本游戏是做测试用的,这些文字也是,都不是瞎写的! ";
 
		/** 
		* aboutTheGame :要 绘制 的 字符串   ,textPaint(TextPaint 类型)设置了字符串格式及属性 的画笔,240为设置 画多宽后 换行,后面的参数是对齐方式... 
		*/ 
		Canvas can = new Canvas();
		StaticLayout layout = new StaticLayout(aboutTheGame,textPaint,240,Alignment.ALIGN_NORMAL,1.0F,0.0F,true);
		//从 (20,80)的位置开始绘制 
		can.translate(20,80);
		layout.draw(can);
	}