问题
I have searched the documentation and have not found an answer so here we go:
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.
Thanks in advance!
回答1:
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 -
- Make your layouts more flexible and sized based on their contents.
- You can use
getResources().getConfiguration().fontScale
to determine the scale at runtime, and select or adjust your layout(s) accordingly. - This may cause more harm than good, and the docs explicitly say not to do this, but you could try using
sp
rather thandp
for your various layout parameters as well.
来源:https://stackoverflow.com/questions/27364176/android-resource-qualifiers-for-huge-small-fonts-accessibility