我测试了模拟器和真实设备,但正如你所见,40 dp 和 40.2 dp 之间没有变化!我正在开发一个字体敏感度非常高的项目,问题是 android 文本引擎的行为。
有什么办法可以防止这种情况发生吗?
请帮忙!
这是代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SAMPLE TEXT"
android:textSize="40dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SAMPLE TEXT"
android:textSize="40.2dp" />
</LinearLayout>
结果: