您的位置:首页 > 其它

TextView的setCompoundDrawables不显示问题解决

2016-04-14 16:04 337 查看
TextView可以用过调用setCompoundDrawables设置一张图片出现在上下左右四个地方。代码如下:
Drawable drawable = getResources().getDrawable(R.drawable.img);

drawable.setBounds(0, 0, 32, 32);

textView.setCompoundDrawables(drawable, null, null, null);

注意到这个Drawables必须已经调用过了setBounds。如果不设置则无法显示。

转自:http://www.amsoft.cn/post-108.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: