今天想对程序里的文字作个适配,网上找到了个你们疯转的方法。this.getResources().getDimension(); android
因而乎就引出了下面的问题,我不知道是什么问题。也没找到答案! 布局
本着测试为主,就创建了一个,如下是dimens.xml的代码: 测试
<resources> <dimen name="text_size">24.0sp</dimen> </resources>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" android:background="@drawable/login_bg" android:orientation="vertical" > <TextView android:id="@+id/test_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="测试" android:textColor="#000000" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="测试" android:textColor="#000000" android:textSize="@dimen/text_size" /> </LinearLayout>
模拟器分是: this
我没有找到关于解释的资料~ 实在是是搞不懂。 code
我的初步怀疑,它把sp还原成了px~~ xml
不知道你们有没有遇到过~ 有的话能够聊聊~ utf-8