【发布时间】:2021-10-17 12:10:15
【问题描述】:
我的 textallcaps 有问题,在 Android Studio 中显示正常,见图:
但在设备上运行时文本仍为小写,请参见图片:
字体是 Fira GO, 我还尝试了不同的大写字体,但结果仍然相同。 任何想法我怎样才能让它发挥作用?
编辑: 字体 XML:
<?xml version="1.0" encoding="utf-8"?>
<font-family
xmlns:android="http://schemas.android.com/apk/res/android">
<font
android:fontStyle="normal"
android:fontWeight="400"
android:font="@font/firago_regular" />
</font-family>
用户界面 XML:
<TextView
android:textSize="22sp"
android:textColor="@color/maincolor"
android:fontFamily="@font/firago"
android:text="@{pagetitle}"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
【问题讨论】:
-
分享你的xml文件
-
@PriyankaRajput 好的,我编辑了问题并添加了 xlm 代码
-
您刚刚添加了字体系列xml,我们需要检查UI xml
-
@PriyankaRajput 我的错,现在我添加了 Textview,代码
-
检查 pagetitle 的值,你要为 textview 设置什么。
标签: android view fonts display