TextView的isBold总是返回师范大学 [英] TextView isBold always returns NORMAL
本文介绍了TextView的isBold总是返回师范大学的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我设置字样
textView.setTypeface(tf_roboto_medium, Typeface.BOLD);
当我使用这个命令检查的风格,这是真正的评估
When I check the style using this command, it is evaluated true.
if (textView.getTypeface().getStyle() == Typeface.NORMAL) {
// always here
}
else {
// never here
}
这里是我的TextView的XML内容
Here is my xml content for the TextView
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="Train"
android:textColor="#777777"
android:gravity="bottom|center"
android:singleLine="true"
android:id="@+id/txt_train"
android:layout_gravity="left"
android:layout_weight="15"
android:textSize="32px"
android:onClick="onTrainClick"
android:clickable="true" />
我在做什么错了?
What am I doing wrong?
PS:我已阅读其他职位要求同样的事情。他们没有似乎为我工作。因此,quesiton
PS : I have read other posts asking for the same thing. None of them seems to work for me. Thus the quesiton
推荐答案
您可以做一个字符串:
<string name="train"><b>Train</b></string>
然后设置:
android:text="@string/train"
这篇关于TextView的isBold总是返回师范大学的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文