[英]Font size on different devices
I use sp
for my TextView
font size 我将sp
用作TextView
字体大小
But the size in mobiles and tablets is similar 但是手机和平板电脑的尺寸差不多
My xml : 我的xml:
<TextView
android:id="@+id/TextView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Register"
android:textColor="#fff"
android:textSize="14sp" />
Output : 输出:
What I want : 我想要的是 :
You should save different layout for different sizes in drawable files. 您应该在可绘制文件中保存不同大小的不同布局。
In each folder you have separate xml file. 在每个文件夹中,您都有单独的xml文件。
In each xml you can define different android:textSize
. 在每个xml中,您可以定义不同的android:textSize
。
For example, in: 例如,在:
drawable-hdpi folder: android:textSize = "10sp"
drawable-hdpi文件夹: android:textSize = "10sp"
drawable-ldpi folder: android:textSize = "12sp"
drawable-ldpi文件夹: android:textSize = "12sp"
drawable-mdpi folder: android:textSize = "14sp"
drawable-mdpi文件夹: android:textSize = "14sp"
drawable-xhdpi folder: android:textSize = "16sp"
drawable-xhdpi文件夹: android:textSize = "16sp"
drawable-xxhdpi folder: android:textSize = "18sp"
drawable-xxhdpi文件夹: android:textSize = "18sp"
you can use different qualifiers for each xml or values file. 您可以为每个xml或values文件使用不同的限定符。
ie, if you want same design with different styles,you can use 2 styles.xml files with different qualifiers.for eg styles.xml and styles-sw600dp.xml this creates a general style and a 7" tablet style. here sw600dp denotes smallest width as 600dp which is typically used in 7" tabs. 即,如果您希望使用不同的样式进行相同的设计,则可以使用2个具有不同限定符的styles.xml文件。例如,styles.xml和styles-sw600dp.xml会创建一个通用样式和一个7英寸的平板电脑样式。此处sw600dp表示最小样式宽度为600dp,通常用于7英寸的标签中。
You can get a detailed overview of Multiple Screens in the Android documentation. 您可以在Android文档中详细了解“ 多个屏幕 ”。
you can also define different layouts with the help of qualifiers 您还可以在限定符的帮助下定义不同的布局
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.