[android-developers] Re: fromHtml doesn't work for textview font size, any help?
The size attribute is just ignored. Only "color" and "face" attributes takes into account. But you can use the Spannable span.setSpan(new RelativeSizeSpan(0.8f), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) or the content, content content attributes of HTML to set the corresponding requirements. you could also use the but you will run into issues regarding the margin On Wednesday, December 29, 2010 at 4:41:02 PM UTC+3, genxsol wrote: > > Hi Dear, > > i am trying to put text on a text view with different size for each > word > > textView.setText(Html.fromHtml(" Word1 font> Word2 ))); > > color does work but no font size, any help plz -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/0b26d264-0541-489b-99e8-1a9c138fa519%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] Re: fromHtml doesn't work for textview font size, any help?
As far as I can see, when converting from HTML string into spannable, only color and face are supported (this is with Android 4+ at least). Converting the otherway (Html.toHtml) adds more attributes like size. To control the size from HTML you are limited to big and small or add your own tag and implement Html.TagHandler. Remember that you can set the base text size of the TextView and then use big and small to go +/-. On Wednesday, 29 December 2010 15:41:02 UTC+2, genxsol wrote: Hi Dear, i am trying to put text on a text view with different size for each word textView.setText(Html.fromHtml(font size='10' color='red' Word1 / font font size='15' color='white' Word2 /font))); color does work but no font size, any help plz -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [android-developers] Re: fromHtml doesn't work for textview font size, any help?
Html.fromHtml also understands header tags, from h1 to h6. The respective relative sizes are: private static final float[] HEADER_SIZES = { 1.5f, 1.4f, 1.3f, 1.2f, 1.1f, 1f, }; -- K 2014-04-09 23:22 GMT+04:00 jraanamo jukka.raan...@gmail.com: As far as I can see, when converting from HTML string into spannable, only color and face are supported (this is with Android 4+ at least). Converting the otherway (Html.toHtml) adds more attributes like size. To control the size from HTML you are limited to big and small or add your own tag and implement Html.TagHandler. Remember that you can set the base text size of the TextView and then use big and small to go +/-. On Wednesday, 29 December 2010 15:41:02 UTC+2, genxsol wrote: Hi Dear, i am trying to put text on a text view with different size for each word textView.setText(Html.fromHtml(font size='10' color='red' Word1 / font font size='15' color='white' Word2 /font))); color does work but no font size, any help plz -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.