最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Android字体变成加粗

Android crifan 7408浏览 0评论

【背景】

在Android中想要把某些字符变成加粗。

【解决过程】

1.搜:

android text bold

找到:

android – TextView bold via xml file? – Stack Overflow

改为:

<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,添加:

android:textStyle="bold"

即可。

效果如下:

android text is bold now

 

【总结】

想要设置字符为加粗,在xml中给TextView等控件添加属性:

android:textStyle="bold"

即可。

转载请注明:在路上 » 【已解决】Android字体变成加粗

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.164 seconds, using 22.10MB memory