如何让一个TextView大胆? [英] How to make a TextView bold?
本文介绍了如何让一个TextView大胆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望能够做出一个TextView大胆。这就是我设置它的外观(我需要为此在code):
nameText.setTextAppearance(getApplicationContext(),R.style.BlueText);
priceText.setTextAppearance(getApplicationContext(),R.style.BlueText);
changeText.setTextAppearance(getApplicationContext(),R.style.BlueText);
下面是我的style.xml
<! - 蓝颜色 - >
<样式名称=BlueText>
<项目名称=机器人:文字颜色>#4871A8< /项目>
< /风格>
我如何确保我的TextView被加粗?
解决方案
<! - 蓝颜色 - >
<样式名称=BlueText>
<项目名称=机器人:文字颜色>#4871A8< /项目>
<项目名称=机器人:文字样式>大胆< /项目>
< /风格>
I want to be able to make a TextView bold. This is how I am setting it's appearance (I need to do this in code):
nameText.setTextAppearance(getApplicationContext(), R.style.BlueText);
priceText.setTextAppearance(getApplicationContext(), R.style.BlueText);
changeText.setTextAppearance(getApplicationContext(), R.style.BlueText);
Here is my style.xml
<!-- Blue Color -->
<style name="BlueText">
<item name="android:textColor">#4871A8</item>
</style>
How can I make sure my TextView is bolded?
解决方案
<!-- Blue Color -->
<style name="BlueText">
<item name="android:textColor">#4871A8</item>
<item name="android:textStyle">bold</item>
</style>
这篇关于如何让一个TextView大胆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文