Android drawText获取text宽度
Android 获取 Text 宽度
2023-09-27 14:27:46 时间
private int getTextWidth(Paint paint, String str) {
int iRet = 0;
if (str != null && str.length() > 0) {
int len = str.length();
float[] widths = new float[len];
paint.getTextWidths(str, widths);
for (int j = 0; j < len; j++) {
iRet += (int) Math.ceil(widths[j]);
}
}
return iRet;
}
相关文章
- Android开发之实现锁屏功能
- Android 获取控件相对于屏幕位置
- 《精通Android 实例开发》——第1章,第1.5节将Android SDK和Eclipse相关联
- Android蓝牙自动配对Demo,亲测好使!!!
- Android实时获取音量(单位:分贝)
- Android多媒体分析-通过MediaStore获取Audio信息
- android 实现蓝牙自动配对连接
- Android应用程序启动过程源代码分析
- 关于android各种双卡手机获取imei,imsi的处理(mtk,展讯,高通等)
- Android中getLocationOnScreen和getLocationInWindow 获取屏幕大小
- Android之SurfaceView与多线程的混搭
- android 通过socket获取IP
- Android:Touch和Click的区别
- android 获取Bitmap 的两种方法
- Delphi xe7 FireMonkey / Mobile (Android, iOS)生成 QR Code完整实例
- Android 获取WiFi列表并自动连接
- Android实现戴口罩人脸检测和戴口罩识别(附Android源码)
- Android获取onenet中的数据----Get( )方法---(详细)
- android红米等关于读取本地文件夹图片获取路径的问题的解决
- Android Studio 基础 之 获取蓝牙Bluetooth 的状态,设置的蓝牙Bluetooth 的开关状态,并监听蓝牙Bluetooth 的状态变化方法整理
- Android在网络上分析获取图片(支持bmp格式)