The drawableLeft (or any of the similar attributes) XML attribute can be modified (removing a drawable in your case) via code using something like this:
yourTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); //这个就是隐藏方法
yourTextView.setText("The Text You Need In There");
The constructor for the method is in this order:
setCompoundDrawablesWithIntrinsicBounds (int left, int top, int right, int bottom)
Read more about the method setCompoundDrawablesWithIntrinsicBounds here
本文介绍了一种通过代码方式修改XML属性来移除TextView中drawable图标的方法。具体操作是使用setCompoundDrawablesWithIntrinsicBounds方法设置参数为0, 从而达到隐藏左侧图标的目的。
1869

被折叠的 条评论
为什么被折叠?



