Paint.getTextBounds()的记录

官网API:

getTextBounds

Added in  API level 1
void getTextBounds (String text, 
                int start, 
                int end, 
                Rect bounds)

Return in bounds (allocated by the caller) the smallest rectangle that encloses all of the characters, with an implied origin at (0,0).由调用者返回在边界(分配)的最小矩形包含所有的字符,以隐含原点(0,0)。

Parameters
text String: String to measure and return its bounds 要测量的字符串,并返回它的界限
start int: Index of the first char in the string to measure   在这个字符串里的 第一个字符的索引,它将作为测量的起点
end int: 1 past the last char in the string measure 我觉得这个是:超出最后一个字符1位,然后就测量到这个位置。
bounds Rect: Returns the unioned bounds of all the text. Must be allocated by the caller.返回包含所有文本在内,所形成的边界,(所以叫unioned bounds)。必须分配给调用者。

getTextBounds

Added in  API level 1
void getTextBounds (char[] text, 
                int index, 
                int count, 
                Rect bounds)

Return in bounds (allocated by the caller) the smallest rectangle that encloses all of the characters, with an implied origin at (0,0).由调用者返回在边界(分配)的最小矩形包含所有的字符,以隐含原点(0,0)。


Parameters
text char: Array of chars to measure and return their unioned bounds一个包含字符的数组,测量并返回他们的联合边界
index int: Index of the first char in the array to measure   在这个 数组 里的 第一个(要测量的)字符的索引(你不一定要指定为0, 虽然那确实意味着从第一个开始),它将作为测量的起点 
count int: The number of chars, beginning at index, to measure字符的数量(比如5),测量将会 开始于上面指定的索引号,结束于 此数量值之后(若为5, 则上面指定的索引号+5)
bounds Rect: Returns the unioned bounds of all the text. Must be allocated by the caller.返回包含所有文本在内,所形成的边界,(所以叫unioned bounds)。必须分配给调用者。




我在另外一个博客看到此文章,但他翻译不好,故我再琢磨一下写此,也水一篇文章
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值