如何使用dimens.xml在android中设置文本大小 [英] how to use dimens.xml to set text size in android
本文介绍了如何使用dimens.xml在android中设置文本大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
i想要为所有Android设备正确设置文本大小,所以我决定使用dimens.xml
但不幸的是,当我尝试设置文本大小时,我收到错误
错误:找不到与TextSize中给定名称匹配的资源,其值为@ dimens / Big
这里是我的dimens.xml是在/res/value-hdpi/dimens.xml中定义的:
< 资源 >
< dimen name = 大 > 70sp < / dimen >
< / resources >
和我的Xml文件:
< TextView
android:layout_width = wrap_content
android:layout_height = wrap_content
android:text = Seyed Mahmud Shahrokni
android:textSize = @ dimens / Big
/ >
任何建议?
解决方案
缺少's'值目录应该是:
/res/values-hdpi/dimens.xml
了解更多:< a href =http://www.codeproject.com/Articles/809067/Becoming-Resourceful-with-Android-Resources#alternative_resources>使用Android资源获得足够的资源 [ ^ ]
hi guys . i am working on an android application .
i wanted to set text size correctly for all android devices , so i decided to use dimens.xml
but unfortunately when i tried to Set text Size , i got an error
Error : No resource found that matches the given name at TextSize with value @dimens/Big
here is my dimens.xml which was defined in /res/value-hdpi/dimens.xml :
<resources>
<dimen name="Big">70sp</dimen>
</resources>
and this my Xml File :
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Seyed Mahmud Shahrokni"
android:textSize="@dimens/Big"
/>
any suggestion ?
解决方案
missing 's' for the value directory, should be:
/res/values-hdpi/dimens.xml
Read more: Becoming Resourceful with Android Resources[^]
这篇关于如何使用dimens.xml在android中设置文本大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文