放入大胆一个TextView的某些部分? [英] Put in bold some parts of a TextView?
本文介绍了放入大胆一个TextView的某些部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这里面一个TextView,我写的问题和答案。如果我现在想提出大胆仅作为的问题怎么办?这里也许有些code,让你把粗体文本字符0-10例如?能力
I have a TextView inside which, I wrote of the questions and answers. If I now want to put in bold only the questions as I do? There maybe some code that gives you the ability to put in bold text character 0-10 for example?
推荐答案
有关这种方式是什么
textView.setText(Html.fromHtml("MyText<b>MyBoldText</b>"));
输出应是这样的MYTEXT MyBoldText
,你也可以做到这一点使用字符串
and you can also do this using string
<string name="myMixedText">My simple Text<b>My Bold Text<i>MyBoldItalicText</i></b></string>
现在
textView.setText(R.string.myMixedText);
输出应是这样的:我简单的文字我粗体文字 MyBoldItalicText
这篇关于放入大胆一个TextView的某些部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文