xml 自适应TextView的字体大小

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml 自适应TextView的字体大小相关的知识,希望对你有一定的参考价值。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
 
    <TextView
        android:layout_width="80dp"
        android:layout_height="wrap_content"
        android:background="@android:color/holo_blue_bright"
        android:gravity="center"
        android:maxLines="1"
        android:text="seachal zhang@ csdn"
        android:textColor="@android:color/white"
        android:textSize="80dp" />
 
    <TextView
        android:id="@+id/text"
        android:layout_width="80dp"
        android:layout_height="wrap_content"
        android:autoSizeMaxTextSize="80dp"
        android:autoSizeMinTextSize="2dp"
        android:autoSizeTextType="uniform"
        android:background="@android:color/holo_red_light"
        android:gravity="center"
        android:maxLines="1"
        android:text="seachal zhang @ csdn"
        android:textColor="@android:color/white"
        android:textSize="80dp" />
</LinearLayout>

以上是关于xml 自适应TextView的字体大小的主要内容,如果未能解决你的问题,请参考以下文章

java 自适应字体的的TextView

如何让Android字体自适应屏幕分辨率

在使用xml的android TextView中使用自定义字体

h5中的字体大小自适应;

Android开发 如何重写SimpleAdapter,自定义字体的大小?

Android中TextView中的字体大小能设置吗