标签: scale-independent

应用程序文本大小不随系统字体大小缩放

我不得不在现有的 Android 应用程序上工作,其中所有文本都在布局 XML 文件中的 SP 单元中提及。

但是,应用程序的文本大小不会随系统字体一起调整。即,如果我从 更改系统字体大小Settings -> Accessibility -> Font Size,应用程序的字体大小根本不会改变。

PFB 摘自我的布局文件,其中TextView's textSize在 SP 中提到。

<LinearLayout
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:gravity="center"
    android:orientation="vertical"
    android:padding="12dp">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:gravity="center"
        android:text="@string/find_an_noffice"
        android:textSize="12sp"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我认为问题与布局结构无关,因此我在示例应用程序中使用了相同的布局文件。此示例应用程序按预期工作。即,应用程序的字体大小与系统字体一起调整。

我的原始应用程序不作为示例应用程序运行的可能性有哪些?

任何帮助,将不胜感激。

fonts android r-sp scale-independent

4
推荐指数
1
解决办法
1234
查看次数

标签 统计

android ×1

fonts ×1

r-sp ×1

scale-independent ×1