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=)
your best option is to create your own view, and to override the onDraw() method using canvas.drawText() for text, and canvas.drawBitmap() for images.
See the Canvas doc : http://developer.android.com/reference/android/graphics/Canvas.html
Here is an example which draw some text at the center of the screen :
I think you are looking for the Spannable interface, By using this you can add images to a text view.
This link might help.
This can be done with image getter: Html.ImageGetter
You will have to use HTML tags for each image.
as I know, there's no way to do it.
but when you use webview and generated html you can do simillar one.
generate html from your contents, and load it to webview, set webview settings to no zoom control.
Add this in to your String and it will work