I thought you are using a textview. I don't know if the canvas
actually supports it.

do something like

 myTextView.setText(Html.fromHtml(myHtmlString))

by the way, I found the list of supported tags:

•br
•p
•div
•em
•b
•strong
•cite
•dfn
•i
•big
•small
•font
•blockquote
•tt
•monospace
•a
•u
•sup
•sub



On Mar 19, 9:09 am, Fina Perez <[email protected]> wrote:
> Hi! Thanks for your answer.
> For my purpose, I just need the tags you mentioned. The problem is
> that when I send the text to the rectangle, it loose the format. I do
> something like:
>
> CharSequence myString; //it has for example <b>Hello</b> world
>
> //I dont know if this is correct
> myString = Html.fromHtml(myString);
>
> //and now I paint the text
> canvas.drawText(myString,...);
>
> But this isn't working, and I can't use a webView(or even a textView)
> because I paint my view manually, with canvas and rectangles...I don't
> know if there is a way to paint a textView, for example, in a BitMap.
>
> On Mar 19, 1:18 pm, lbendlin <[email protected]> wrote:
>
>
>
> > While it is possible, it is also very limited. Only a few HTML tags
> > are honoured, like smaller/bigger, bold etc.  I think that even for
> > this little functionality you will spend a whole HTML rendering engine
> > in memory, and that's just not worth it.
>
> > If you must, use a webview.
>
> > On Mar 18, 11:55 am, Fina Perez <[email protected]> wrote:
>
> > > Hi!!
> > > I'm trying to paint a rectangle, and inside it, put some text which is
> > > "html-format" (sorry for my english, it is so bad ) I use CharSequence
> > > (because this supports html) instead of String, and I call drawText
> > > with those parameters, but the format isn't painted.
>
> > > Any idea? is it possible?
>
> > > Thanks a lot!- Hide quoted text -
>
> - Show quoted text -

-- 
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

Reply via email to