【背景】
在Android中想要把某些字符变成加粗。
【解决过程】
1.搜:
android text bold
找到:
android – TextView bold via xml file? – Stack Overflow
改为:
1 2 3 4 5 6 7 8 9 10 | < TextView android:id = "@+id/variableGroupName" android:layout_width = "wrap_content" android:layout_height = "wrap_content" android:layout_marginLeft = "20dp" android:paddingBottom = "10dp" android:paddingTop = "10dp" android:text = "@string/device_variable" android:textStyle = "bold" /> |
即:
对于xml中的TextView,添加:
1 | android:textStyle="bold" |
即可。
效果如下:
【总结】
想要设置字符为加粗,在xml中给TextView等控件添加属性:
1 | android:textStyle="bold" |
即可。
转载请注明:在路上 » 【已解决】Android字体变成加粗