getTextBounds 方法作用
来源:互联网 发布:网络小胖表情包 编辑:程序博客网 时间:2024/06/07 11:48
Rect mBounds = new Rect();
mPaint.setColor(Color.BLUE);canvas.drawRect(0, 0, getWidth(), getHeight(), mPaint);mPaint.setColor(Color.YELLOW);mPaint.setTextSize(30);String text = String.valueOf(mCount);mPaint.getTextBounds(text, 0, text.length(), mBounds);float textWidth = mBounds.width();float textHeight = mBounds.height();canvas.drawText(text, getWidth() / 2 - textWidth / 2, getHeight() / 2+ textHeight / 2, mPaint);
getTextBounds 是将TextView 的文本放入一个矩形中, 测量TextView的高度和宽度,还有一下方法
参考:http://blog.csdn.net/it_transformers/article/details/46041899
0 0
- getTextBounds 方法作用
- Android的DrawText,getTextBounds
- Paint.getTextBounds()的记录
- android-Paint-getTextBounds参数详解
- Paint类measureText与getTextBounds的区别
- Paint类measureText与getTextBounds的区别
- Paint.getTextBounds (String text, int start, int end, Rect bounds)
- 属性、方法作用范围
- 属性、方法作用范围
- 匿名方法的作用
- System.getProperty方法作用
- 构造方法私有化作用
- java toString方法作用
- HashCode方法的作用
- 类方法、作用域
- hashCode()方法的作用
- hashCode方法的作用
- attachEvent方法的作用
- POJ 2965 The Pilots Brothers' refrigerator
- 1、Struts框架学习
- Maven Project java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListene
- WPF MVVM 简单实现
- Linux kernel 内存子系统
- getTextBounds 方法作用
- android的Application使用
- 在内部存储中读写文件
- 【HUSTOJ】1065: 斜角II
- how to use dbx in Solaris -Debugging Your Program With dbx
- 天气JSON接口
- Linux下安装WPS的一些问题
- cf 666B
- 反射·类加载与垃圾回收