官网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)。必须分配给调用者。 |
我在另外一个博客看到此文章,但他翻译不好,故我再琢磨一下写此,也水一篇文章