Spannable of android
I am working with an edit text to support the properties of bold,italic and underline.I got succeed after selecting the text and clicking on b开发者_如何学Cold my text was bold.Now what my requirement is how to remove the bold again after selecting the text and clicking on bold button.
Regards, Bhavani.G
Thank you for the reply.Actually, What my need is if i select some text and clicking on Bold button(I have implemented this with spannable)in edit text/autocomplete text view my text is becoming bold.
Now, Again selecting the bolded text and by clicking on the bold button it should become normal text.
To achieve this i should know my text is in bold.How to do this??
Regards,
vani
Is this what your looking for?
((TextView) view).setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
RemoveSpan
would to the trick i think, but you'll have to extract the part of your SpannableString
in which you want to make the change to prevent removing all bold from your text! and then use TextUtils.concat(span1, span2, ...)
from android.text to regroup ^^
精彩评论