我正在尝试在SpannableString
上获取应用的跨度集,然后找到它们应用的范围。那可能吗?据我所知,似乎并没有内置的方法来做到这一点。我是对的吗?
Object[] spans = spannableString.getSpans(0, spannableString.length(), Object.class);
List<Object> spanArray = asList(spans);
for (Object span: spanArray) {
if (span.getClass().equals(MyCustomSpan.class)) {
MyCustomSpan s = (MyCustomSpan) span;
// Get the range in spannableString where this span has been applied.
// How do I do this?
}
}