Html.ImageGetter

前端 未结 4 1243
暖寄归人
暖寄归人 2020-11-29 03:32

Can any one help me out how to use Html.ImageGetter to dispaly images using html image src tag ? and example or good tutorial

4条回答
  •  独厮守ぢ
    2020-11-29 04:08

    textView.setText(Html.fromHtml(htmlToSetAsText, new ImageGetter() {                 
        @Override
        public Drawable getDrawable(String source) {
            String path = "/sdcard/" + source;
            Drawable bmp = Drawable.createFromPath(path);
            bmp.setBounds(0, 0, bmp.getIntrinsicWidth(), bmp.getIntrinsicHeight());
    
            return bmp;
        }
    }, null));
    

提交回复
热议问题