开发者

Spannables & Spanned Text in Android EditText

开发者 https://www.devze.com 2023-03-01 03:10 出处:网络
I fetch html data and wish to show it in a rich text editor in android. I can do it as long as long as they just have basic stuff like bold, italic. How can I findout if the text has other Spanned or

I fetch html data and wish to show it in a rich text editor in android. I can do it as long as long as they just have basic stuff like bold, italic. How can I findout if the text has other Spanned or spannables used which gives me early warning for incompatibility?

Spanned.getSpans() works but its specific for each span e.g. underline, fontFace. I would have to call getSpans for all varia开发者_StackOverflow中文版nts. Isn't there a method that would return all types of spans used in the text?

I dont really wann use regex or string operations for this.


You can pass Object.class to Spanned.getSpans() to get all spans or you can pass CharacterStyle.class to get all style spans.

0

精彩评论

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