2

So I have my TextView named 'container'

container.setText(Html.fromHtml(text, new URLImageParser(container, this),null));

with URLImageParser from Android HTML.fromHTML() with images?

this works fine and displayes the image. The problem is that I want to define the size of the image in the html tag. <img src=".." width="30px"> doesn´t work in all kind of variations!

Any idea how to set the image size in the html?

Community
  • 1
  • 1
joohaha
  • 147
  • 2
  • 3
  • 12
  • *Any idea how to set the image size in the html?* You can't .... but i got an idea ... you could try to append size to the and of url ... fx http://example.com/images/image_1.png#120x100 ... and then make of use it in whithin `ImageGetter.getDrawable` ... – Selvin Jan 29 '16 at 15:26
  • @Selvin thank you that actually worked! Just seems a little bit messy... – joohaha Feb 01 '16 at 08:35
  • *a little bit messy* maybe ... but `Html.fromHtml()` supports only few tags and attributes ... so if you don't wana create ImageSpan by your own (by parsing HTML by yourself) then I think it's a acceptable way of doing this ... just take a look at [Html class source](https://github.com/android/platform_frameworks_base/blob/master/core/java/android/text/Html.java#L635) - the only attribute that it cares its "src" – Selvin Feb 01 '16 at 10:42
  • @Selvin yes I am actually working with this and it works fine. If you put this as an answer I will accept. – joohaha Feb 01 '16 at 11:24

0 Answers0