Google does this with custom ImageSpan. I have just successfully implemented this application for one of my applications. You should look at RecipientEditTextView.java to see how they do it. Essentially, they create the ability to draw with Canvas and assign this value to a custom, custom ImageSpan. I cannot post any code since ... well there is a ton, however you should get a good idea looking through the source.
source share