android 代码实现android:drawablePadding="5dp"
(2015-06-14 11:39:06)
标签:
情感 |
分类: android应用 |
不多说,直接看下面的代码:
Drawable drawable =
getResources().getDrawable(R.drawable.ti_calendar)
;
drawable.setBounds(0, 0, drawable.getMinimumWidth(),
drawable.getMinimumHeight()) ;
textView.setCompoundDrawables(drawable, null, null, null)
;
textView.setCompoundDrawablePadding(dip2px(5))
;
很明显上面的是设置一个TextView左侧的图片,但是如何在代码中设置图片与文字的间距尼,
一句话记录一下:
textView.setCompoundDrawablePadding(int)
;
后一篇:Axure教程