在代码中改变TextView的drawableLeft或draw

2018-03-05  本文已影响12人  beforenight
  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);  
上一篇 下一篇

猜你喜欢

热点阅读