android 中 textview 的大小未根据显示类型更改

size of the textview is not changing as per display type in android

我正在创建显示我的自定义布局的对话框。下面是代码

 <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layoutHdr"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <ImageView
        android:layout_width="@dimen/icon_size_small"
        android:layout_height="@dimen/icon_size_small"
        android:layout_marginLeft="15dp"
        android:gravity="center_horizontal"
        android:src="@drawable/appicon" />

    <TextView
        android:id="@+id/permissionHeader"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:gravity="left"
        android:text="@string/permission_popup_mandate_header"
        android:textColor="@color/black"
        android:textSize="@dimen/font_size_dialog_title"
        android:textStyle="bold" />

这里的问题是如果设备字体是"Huge"或"Small"或"Large",它显示相同的字体,实际上它应该根据设备设置显示

您是否使用 dp 作为您的文字大小?使用 sp 应使其根据设备设置显示。