textView = (TextView) findViewById(R.id.textView);
// textView.setText(Html.fromHtml("<b>textView:</b> \n\tText with a :" +
// "<a href=\"http://www.google.com\">link</a>" +
// "html."));
ImageGetter imageGetter = new ImageGetter() {
@Override
public Drawable getDrawable(String source) {
// TODO Auto-generated method stub
int id = Integer.parseInt(source);
Drawable drawable = getResources().getDrawable(id);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
return drawable;
}
};
textView.append(Html.fromHtml("<b>textView:</b> \n\tText with a :" + "<img src='"+R.drawable.ic_launcher+"'/>",imageGetter,null));
Android TextView 加入图片
最新推荐文章于 2023-12-10 01:43:49 发布