开发者

Get line break offset in a Spannable object

开发者 https://www.devze.com 2023-03-21 05:34 出处:网络
I have a Spannable object formatted like so: This is the first line. This is the second line. It\'s more fun than the first.

I have a Spannable object formatted like so:

This is the first line.

This is the second line. It's more fun than the first.

Why not, lets add a third line.

When I throw it in a TextView, it shows the line breaks as expected. What I want to know is, how do I get the index of the line 开发者_StackOverflowbreaks from the Spannable object? I looked at all the Spans applied and all I saw were RelativeSizeSpans and StyleSpans. Thanks.


I was treating a Spannable as if it was it's own special class, but it extends CharSequence, which means the underlying data is just normal text. I just did an indexOf(' ') and was able to find my solution.

0

精彩评论

暂无评论...
验证码 换一张
取 消