admin 发表于 2017-1-13 10:08:03

代码方式为TextView控件设置drawableLeft图标,并设置间距

//在左侧添加图片
    Drawable drawable= getResources().getDrawable(R.drawable.gray_circle);
    drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
      
    textView.setCompoundDrawables(drawable, null, null, null);

    textView.setCompoundDrawablePadding(4);//设置图片和text之间的间距   

页: [1]
查看完整版本: 代码方式为TextView控件设置drawableLeft图标,并设置间距