文字

来源:互联网 发布:js 不用sort数组排序 编辑:程序博客网 时间:2024/04/30 05:47

文字绘制:

String text = getResources().getString(R.string.scan_text);Rect rect = new Rect();paint.setColor(Color.WHITE);paint.setTextSize(25);paint.setAlpha(0xb0);paint.setTypeface(Typeface.create("System", Typeface.BOLD));paint.getTextBounds(text, 0, text.length(), rect);//使rect获得text文字宽度,以便文字居中绘制canvas.drawText(text, (width-rect.width())/2, (float) (frame.bottom + 50), paint);


0 0