Thanks. That works. FWIW it does not work with ordinary String resources (non arrays) in 2.0.1 unless the gt/lt notation is used. So maybe the change was in 2.1. Further in 2.0.1 the <strike> tag doesn't work for Html.fromHtml although it does work when referenced in the XML layout as show above. <u> (and I preseume <b> and <i>) work with both Html.fromHtml and when String resources are referenced in layout.
On Feb 15, 4:15 pm, Mark Murphy <[email protected]> wrote: > jotobjects wrote: > > You are right it doesn't seem to work. Context.getString() strips out > > the format tags. The documentation implies it should work but the > > mechanism is not explained or it is a bug. > > > It does work with the XML directly like - > > > <string name="foobar"><b>my <u>name</u> is <strike>sue</strike></b></ > > string> > > > android:text="@string/foobar" > > The OP also posted this to StackOverflow. The workaround I posted there > for string-array resources is to escape the HTML (e.g., <b>). It > used to be you had to do that for string resources as well -- not sure > when they changed string resources to work sans escaping. > > http://stackoverflow.com/questions/2267118/how-to-style-text-in-a-str... > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > _Android Programming Tutorials_ Version 1.0 In Print! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

