Android:Textview 通过代码设置 Drawable

    /*
     * 
     * @param left 图片在左边
     * @param top 图片在上边
     * @param right 图片在右边
     * @param bottom 图片在下边
     */
  public void  setCompoundDrawables  (Drawable left, Drawable top, Drawable right, Drawable bottom);  

完整代码:

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

你可能感兴趣的:(Android:Textview 通过代码设置 Drawable)