简体   繁体   English

android:如何创建结合icom的TextView?

[英]android: how can i create a TextView combining icom?

is there an easy way to create a text view with an icon inside the text? 有没有一种简单的方法可以创建带有文本内部图标的文本视图? like in this number of rates example: 像这样的费率示例:

(** 3,45642) (** 3,45642)

(I have less then reputeshion 10 so I cant insert the image I wanted (我的名声少于10,所以我无法插入想要的图片

** means an icon of a small man) **表示一个小男人的偶像)

or is it part of RatingBar that i couldn't find? 还是我找不到的RatingBar的一部分?

I don't want to use android:drawableLeft="@drawable/my_icon" as i feel like the parenthesis are critical. 我不想使用android:drawableLeft =“ @ drawable / my_icon”,因为我觉得括号很重要。

Many thanks for any help! 非常感谢您的帮助!

Check out SpannableStringBuilder class. 签出SpannableStringBuilder类。

Usage examples are posted here: 使用示例发布在这里:

http://www.programcreek.com/java-api-examples/index.php?api=android.text.SpannableStringBuilder http://www.programcreek.com/java-api-examples/index.php?api=android.text.SpannableStringBuilder

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM