我可以强调在Android布局的文本? [英] Can I underline text in an android layout?
本文介绍了我可以强调在Android布局的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何定义的强调的在Android的布局文字 XML
文件?
How can I define underlined text in an Android layout xml
file?
推荐答案
可以,如果你使用的是<一个实现href="http://developer.android.com/guide/topics/resources/available-resources.html#stringresources">string资源 XML文件,它支持HTML标签,如&LT; B&GT;&LT; / B&GT;
,&LT; I&GT; &LT; / I&GT;
和&LT; U&GT;&LT; / U&GT;
It can be achieved if you are using a string resource xml file, which supports HTML tags like <b></b>
, <i></i>
and <u></u>
.
<resource>
<string name="your_string_here">This is an <u>underline</u>.</string>
</resources>
如果你想强调从code使用的东西:
If you want to underline something from code use:
TextView textView = (TextView) view.findViewById(R.id.textview);
SpannableString content = new SpannableString("Content");
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
textView.setText(content);
这篇关于我可以强调在Android布局的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文