Android Spanned imageView

232 Views Asked by At

I've created a Spanned object that displays an image along with some text. Is it possible to get that imageView object so I could set it's background?

1

There are 1 best solutions below

0
On BEST ANSWER

There is no ImageView object, so you cannot get it.

If you have an ImageSpan -- either that you added yourself directly or via something like an <img> tag in HTML you parsed with Html.fromHtml() -- you can get at the Drawable for the image. However, that is directly rendered to the canvas, not by way of an ImageView widget.

You can wrap the ImageSpan in a BackgroundColorSpan. Or, make sure that your image has the proper background already (e.g., use a LayerListDrawable).