FabianCook
FabianCook

Reputation: 20587

multiple spans in a charsequence

when ever I set a span in a charsequence, then set the text in a text view its fine, it comes out right. I am using this

Ssb.setSpan(new StyleSpan(Typeface.ITALIC), start, end, 1);

Then set the text of the TextView.

But when I get the text from the text view and then get the text from it using tv.getText(); it returns the CharSequence expected but when I set the span somewhere else in the cs the other span when the text is set it's not there.

Im sorry for lack of code. I have no proper internet access at home so im posting this from my phone.

Upvotes: 1

Views: 1276

Answers (1)

try this

Spannable mSpannable = textview.getText(); // will hold old spans.
mSpannable.setSpan(new StyleSpan(Typeface.ITALIC), start, end, 1); // do some new span

Upvotes: 1

Related Questions