Get line break offset in a Spannable object
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 RelativeSizeSpan
s and StyleSpan
s. 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.
精彩评论