当对textView直接用 tv.setCompoundDrawables(drawable, null, null, null); 设置图片时。图片不会显示出来。因为没有对Drawable设置Bounds。正确代码如下:
Drawable drawable = getResources().getDrawable(R.drawable.ic_biyan_nor); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getMinimumHeight()); tv.setCompoundDrawables(drawable, null, null, null);