版权声明:本文为程序园中猿原创文章,转载请注明出处 https://blog.csdn.net/yinxing2008/article/details/85163135
- 增加style定义
<style name="myTextStyle">
<item name="android:textStyle">bold</item>
<item name="android:textSize">16sp</item>
</style>
- XML文件中使用
<TextView
style="@style/text_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
</TextView>
- Java代码中使用(API需要大于等于23)
TextView.setTextAppearance(this, R.style.myTextStyle);
安卓开发技术分享: https://blog.csdn.net/yinxing2008/article/details/84555061