我读过an answer from this linkandroid - 如何将imageview放在textview字母之上?
,但我想增加每个TextView的
的顶部有些图标该怎么做?任何想法?
我使用layout_above
,layout_below
等尝试,但它不是我希望
编辑:
图像尺寸大,如何设置的图像尺寸增加android:drawableTop="@drawable/image"
我读过an answer from this linkandroid - 如何将imageview放在textview字母之上?
,但我想增加每个TextView的
的顶部有些图标该怎么做?任何想法?
我使用layout_above
,layout_below
等尝试,但它不是我希望
编辑:
图像尺寸大,如何设置的图像尺寸增加android:drawableTop="@drawable/image"
只需使用android:drawableTop="@drawable/YOUR_DRAWABLE"
其简单。
要设置运行时使用的代码 -
imgView.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.imgSrc, 0, 0);
这里(0,R.drawable.imgSrc,0,0),左顶右底 0,如果你不希望添加。
使用此对您的XML
android:drawableTop="@drawable/your_image"
android:drawablePadding="10dp"
或者你Activity类
textView.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.your_image, 0, 0);
textView.setCompoundDrawablePadding(10);
还有一些设置图像的大小? – dreq
什么可绘银的代码? _ **编辑** _有一些方法来设置图像/图标的大小?或者我应该调整图像大小? – dreq
@dreq看编辑答案 –