android canvas drawText 使用说明

 

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. //以一行文本最靠上的位置为基线往上的距离(为负数)

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值