[英]How to make a TextView bold?
我希望能够使TextView变粗。 这就是我设置它的外观(我需要在代码中执行此操作):
nameText.setTextAppearance(getApplicationContext(), R.style.BlueText);
priceText.setTextAppearance(getApplicationContext(), R.style.BlueText);
changeText.setTextAppearance(getApplicationContext(), R.style.BlueText);
这是我的style.xml
<!-- Blue Color -->
<style name="BlueText">
<item name="android:textColor">#4871A8</item>
</style>
如何确保我的TextView加粗?
<!-- Blue Color -->
<style name="BlueText">
<item name="android:textColor">#4871A8</item>
<item name="android:textStyle">bold</item>
</style>
在相关的说明中,如果您想要在没有任何XML的情况下执行相同操作,则可以执行以下操作:
TextView myText = new TextView(this);
myText.setTextColor(Color.BLUE);
myText.setTypeface(Typeface.DEFAULT_BOLD);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.