//获取Drawable资源
Drawable drawable = getResources().getDrawable(R.drawable.renzheng);
// / 这一步必须要做,否则不会显示. 设置drawable的宽高
drawable.setBounds(0, 0, ViewUtil.dipint(getContext(), 22),ViewUtil.dipint(getContext(), 22));
//四个参数左,上,右,下 填入对应的参数
tv_company_name.setCompoundDrawables(null, null, drawable, null);
ViewUtil.dipint()//转换对应的dp 上方我的为22dp
public static int dipint(Context context,int dip){
return ((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, context.getResources().getDisplayMetrics()));
}