您的位置:首页 > 其它

TextView设置drawable

2016-02-04 18:01 288 查看
代码:

Drawable drawable = getResources().getDrawable(R.mipmap.a);

drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); //设置边界

tv.setCompoundDrawables(null, null, drawable, null);//画在右边

要注意的: 一定要有setBounds()这段代码,不让不会显示drabable.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: