Html.fromHtml problem

筅森魡賤 提交于 2019-12-13 18:04:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!