TextView 设置图片  

2012-05-17 15:12:38|  分类: Android 订阅

 
 
Drawable img = layout.getResources().getDrawable(R.drawable.icon);
// 调用setCompoundDrawables时,必须调用Drawable.setBounds()方法,否则图片不显示
img.setBounds(0, 0, img.getMinimumWidth(), img.getMinimumHeight());
textView.setCompoundDrawables(img, null, null, null); //设置左图标

相关文章:

  • 2021-12-22
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
  • 2021-08-28
  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-24
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2021-04-09
  • 2022-12-23
  • 2021-11-29
相关资源
相似解决方案