美文网首页
在代码中改变TextView的drawableLeft或draw

在代码中改变TextView的drawableLeft或draw

作者: beforenight | 来源:发表于2018-03-05 14:08 被阅读12次
  1. drawableLeft
left.png

代码如下:

Drawable drawable = context.getResources().getDrawable(R.mipmap.ic_pay_koukuan);  
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());  
textView.setCompoundDrawables(drawable, null, null, null);  
  1. drawableRight


    right.png

代码如下:

Drawable drawable = context.getResources().getDrawable(R.mipmap.ic_pay_koukuan);  
drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());  
textView.setCompoundDrawables(null, null, drawable, null);  

相关文章

网友评论

      本文标题:在代码中改变TextView的drawableLeft或draw

      本文链接:https://www.haomeiwen.com/subject/pckhfftx.html