2017-06-12 56 views

回答

0

只需使用android:drawableTop="@drawable/YOUR_DRAWABLE"其简单。

+0

什么可绘银的代码? _ **编辑** _有一些方法来设置图像/图标的大小?或者我应该调整图像大小? – dreq

+0

@dreq看编辑答案 –

0

要设置运行时使用的代码 -

imgView.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.imgSrc, 0, 0); 

这里(0,R.drawable.imgSrc,0,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); 
+0

还有一些设置图像的大小? – dreq

相关问题