适用于大字体/小字体的Android资源限定符(可访问性) [英] Android resource qualifiers for Huge/Small fonts (accessibility)

查看:96
本文介绍了适用于大字体/小字体的Android资源限定符(可访问性)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索了文档,但没有找到答案,所以我们开始:

I have searched the documentation and have not found an answer so here we go:

使用辅助功能选项时,Android是否具有资源限定符以在不同资源之间进行选择?就像用户将字体大小设置为巨大"时一样.

Does Android have a resource qualifier to select between different resources when accessibility options are used? Like when the user sets font size to Huge.

在处理大字体/小字体时,我想在某些视图上使用不同的尺寸.

I would like use different dimensions on some views when dealing with Huge/Small fonts.

提前谢谢!

推荐答案

否,没有用于字体缩放的资源限定符.我假设您知道用于指定文本大小的sp单位.我建议-

No, there is no resource qualifier for font scale. I assume you're aware of the sp unit for specifying text size. I would suggest either -

  1. 使布局更加灵活,并根据其内容调整大小.
  2. 您可以使用getResources().getConfiguration().fontScale在运行时确定比例,并相应地选择或调整布局.
  3. 这可能造成弊大于利的后果,而文档中明确指出不要这样做,但是您也可以尝试对各种布局参数使用sp而不是dp.
  1. Make your layouts more flexible and sized based on their contents.
  2. You can use getResources().getConfiguration().fontScale to determine the scale at runtime, and select or adjust your layout(s) accordingly.
  3. This may cause more harm than good, and the docs explicitly say not to do this, but you could try using sp rather than dp for your various layout parameters as well.

这篇关于适用于大字体/小字体的Android资源限定符(可访问性)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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