Android Add image to text (in text View)?

user1162299 picture user1162299 · Jan 21, 2012 · Viewed 28.7k times · Source

first post here=) I've been looking for this answer and haven't been able to find it. What I want to do is have some text, then add a image, then rest of text. For example:

                             ____
                            |   |
Hi there, this is the photo |___|, hope you like it..

I've been looking but all I can find is add text to image or add image to image View, and I don't think that's what I want because the app is mainly text but with images on it.

So my question is: How do I add an Image to text?

thanks


UPDATE: I used the advice R.daneel.olivaw gave me and it worked nice=)

But I have a problem. lets say i have: "a b c" where I set the position of b as spanable. But if I try to delete the text and I delete b, the next time I write something it will become the image I used in spanable. How do I correct this? Any1one got any advice? thanks=)

Answer

R.daneel.olivaw picture R.daneel.olivaw · Jan 21, 2012

I think you are looking for the Spannable interface, By using this you can add images to a text view.

This link might help.

enter image description here