I have an EditText which contains smiley faces, the smiley faces are being added to the EditText as a spanable content,

I managed to draw the other things like "underline", "bold" and "italic", but I'm having trouble in drawing the bitmaps. Since when converting the EditText content to a string, the bitmaps are replaced with unicode object character "fffc" http://www.fileformat.info/info/unicode/char/fffc/index.htm

Any help is appreciated

有帮助吗?

解决方案

wouldn't it be easier to let the edit text draw itself into a bitmap and draw that bitmap onto your canvas?

    Canvas c = new Canvas(bitmap); 
    edit.draw(c);

Otherwise you need to get the ImageSpans and use ImageSpan.getDrawable() to draw the smileys:

    ImageSpan[] images = s.getSpans(0, s.length(),ImageSpan.class);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top