【问题标题】:size of the textview is not changing as per display type in androidtextview 的大小不会根据 android 中的显示类型而改变
【发布时间】:2016-08-10 14:49:24
【问题描述】:

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

 <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”,它显示相同的字体,实际上它假设不按设备设置显示

【问题讨论】:

    标签: android dialog font-size


    【解决方案1】:

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

    【讨论】:

    • 我正在使用 dp 。更改为 sp 后它开始工作。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多