如何在textview中添加imageview或在imageview,android中添加textview? [英] How to add imageview inside textview or add textview inside imageview, android?
本文介绍了如何在textview中添加imageview或在imageview,android中添加textview?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否可以在imageview中添加textview,反之亦然。
有可能吗?
如果是,那么如何?
I was wondering if it is possible to add textview inside imageview or vice-versa. Is it possible? If yes then how?
我想在运行时做这个
推荐答案
我认为最简单的方法是通过XML属性setCompoundDrawables
The simplest way I think is to setCompoundDrawables via XML attributes
android:drawableLeft
android:drawableTop
android:drawableRight
android:drawableBottom.
示例:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableRight="@drawable/ic_navigation_chevron_right"
android:text="Next "
android:textSize="20dp" />
结果:
这篇关于如何在textview中添加imageview或在imageview,android中添加textview?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文