public void drawText(String text, float x, float y,Paint paint)

Parameters:
text The text to be drawn     //要绘制的文本
x The x-coordinate of the origin of the text being drawn //要绘制文本起始点的x坐标
y The y-coordinate of the origin of the text being drawn //要绘制文本起始点的y坐标
paint The paint used for the text (e.g. color, size, style) //画笔

这里要特别说明的一点是:origin,起始点指的是从该点右上区域开始绘制文本,也就是绘制文本区域的左下角的点。

Paint.FontMetrics

Fields

如下属性主要表示画笔绘制区域内文本与边框的距离:

public float ascent The recommended distance above the baseline for singled spaced text. //某个文本基线往上的距离(为负数)
public float bottom The maximum distance below the baseline for the lowest glyph in the font at a given text size. //以一行文本最靠下的位置为基线往下的距离
public float descent The recommended distance below the baseline for singled spaced text. //某个文本基线往下的距离
public float leading The recommended additional space to add between lines of text. //行与行之间距
public float top The maximum distance above the baseline for the tallest glyph in the font at a given text size. //以一行文本最靠上的位置为基线往上的距离(为负数)

 

更多相关文章

  1. Android(安卓)Jetpack Compose 之 Text
  2. android 渐变的半圆进度条
  3. java后台接收android客户端通过http方式发送的数据
  4. Android(安卓)TextView 给文本中指定片段添加自定义点击事件
  5. Android(安卓)Jetpack Compose 之 Text
  6. Android(安卓)分享一个流量显示界面
  7. android 生成二维码
  8. Android(安卓)- View的绘制流程一(measure)
  9. Android投票自定义View

随机推荐

  1. 阿里巴巴人脸离线活体识别Android
  2. Android手机gdb调试
  3. 《第一行代码》第十二章引用toolbar出错,
  4. 从android studio安装配置,到写出第一个小
  5. Android---添加结构线或边框的几种方式
  6. android九种对话框
  7. Android(安卓)Handler 教程
  8. Android(安卓)9.0——ActivityManagerSer
  9. make_ext4fs 文件权限控制
  10. AppWidget运用实例