我如何将图像放在TextView
的一段文本下。
例如,我想在我的TextView
中的面包文本下放置面包图像。我真的想在TextView中显示一部分文本的可绘制而不是背景色。 ImageSpan是否可以?
最佳答案
您只需将android:drawablebottom="@drawable/yourimage"添加到xml的TextView中
否则,Java中的等效项是public void setCompoundDrawablesWithIntrinsicBounds (Drawable left, Drawable top, Drawable right, Drawable bottom)
用法:
myText.setCompoundDrawablesWithIntrinsicBounds(null,null,null, myNewDrawable);