TextView中的Andr​​oid应用程序改变字体大小从原生设置改变字体大小 [英] Font size of TextView in Android application changes on changing font size from native settings

查看:140
本文介绍了TextView中的Andr​​oid应用程序改变字体大小从原生设置改变字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望指定在我的应用我自己的文字大小,但我有一个问题,这样做。

I want to specify my own text size in my application, but I am having a problem doing this.

当我更改字体大小的设备设置,我的应用程序的字体大小的TextView 也改变了。

When I change the font size in the device settings, the font size of my application TextView also changes.

推荐答案

其实,设置字体大小只影响大小在 SP 。因此,所有你需要做的 - 定义 TEXTSIZE 而不是 SP DP $ C>,然后设置不会改变文字大小在您的应用程序。

Actually, Settings font size affects only sizes in sp. So all You need to do - define textSize in dp instead of sp, then settings won't change text size in Your app.

下面是一个链接的文档:<一href="http://developer.android.com/guide/topics/resources/more-resources.html#Dimension">Dimensions

Here's a link to the documentation: Dimensions

但是请注意预期的行为是在所有的应用程序的字体尊重用户的preferences。有很多原因,用户可能需要调整字体大小,其中有些甚至可能是医疗 - 视障用户。使用 DP 而不是 SP 文本可能导致不情愿歧视你的一些应用程序的用户。

However please note that the expected behavior is that the fonts in all apps respect the user's preferences. There are many reasons a user might want to adjust the font sizes and some of them might even be medical - visually impaired users. Using dp instead of sp for text might lead to unwillingly discriminating against some of your app's users.

这篇关于TextView中的Andr​​oid应用程序改变字体大小从原生设置改变字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆