问题
I'm using Html.fromhtml to insert image in an editText ... but the instead of displaying the image, it displays [obj] " the text obj inside a square" what could be the problem ?? This is the imageGetter
ImageGetter imageGetter = new ImageGetter() {
public Drawable getDrawable(String source) {
Drawable d = getResources().getDrawable(R.drawable.e11);
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
return d;
}
};
This is the code line:
CharSequence cs =
Html.fromHtml("<img src='" +getResources().getDrawable(R.drawable.e11)+ "'/>"
,imageGetter, null);
回答1:
A better way to do this would be to add a WebView.
回答2:
Your imageGetter
instance is not doing the correct thing. Where is it trying to retrieve the images from and what does it look like?
来源:https://stackoverflow.com/questions/7138636/html-fromhtml-problem