TextView,Button 等设置 setCompoundDrawables 无效

来源:互联网 发布:php beast 破解方法 编辑:程序博客网 时间:2024/05/01 11:43

项目中遇到在代码中设置textview设置图标不显示的问题,后来知道图标必须setBounds

 viewHolder.idTvTitle.setText(MainStone);                    Drawable dra = getResources().getDrawable(R.drawable.icon_add2);                    dra.setBounds(0, 0, dra.getMinimumWidth(), dra.getMinimumHeight());                    viewHolder.idTvTitle.setCompoundDrawables(null,null,null,dra);


原创粉丝点击