How do you all deal with the accessibility settings of font size and display size?

1.8k views Asked by At

Whenever I test these accessibility settings with a larger display size or font size, it seems to almost always break parts of my layout and make it look awful. I really like the feature of autosizing text but these settings being changed seem to making autosizing text useless. Changing the display size also creates issues like weird holes in my table rows for reasons I can't figure out. Weighted views seem to break down in how they should work as well.

I have seen there are a couple of ways to work around these settings and making it so that the user's preferences of these settings do not affect your app. Do you all do this?

I understand the utility of the settings for the users. But, it seems kind of arbitrarily implemented because in order to make the layout work with these settings as a developer you might have to make your text size smaller from the beginning (in order to fit a larger font if user chooses to do this), which would lead to the exact same text size you, as a developer, would have chosen in the first place if you weren't trying to accommodate a larger font size being able to fit. I also believe I have heard that IOS doesn't allow for these accessibility settings to affect third party apps.

I am just curious how you all go about dealing with this. Thanks.

2

There are 2 answers

0
Ole Pannier On

In general, you should always used scale-independent pixels, especially for a large body of text.

However if your text has to fit into a bounding-box of known size then you should use density independent pixels in order to ensure that the text always fits properly and that all characters are visible regardless of the users' setting.

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.

Here's a link to the documentation: Dimensions

0
sigute On

It is possible to ignore the user's preferred font sizing, by using dp instead of sp. Same for display size, if you really want to, you could check the current density and draw something according to that, still sizing things smaller. That's not a good approach. While your layouts will not break that way, the user who prefers a larger font/display sizes will still not be able to use your app, as they need a bigger text size.

There are some different techniques you can use to make layouts scale better:

  • Use minHeight/minWidth attributes in layouts, instead of hardcoding the sizes of the views.
  • Check that the constraints in constraint layouts are bound in both directions, not just start.
  • Allow text views to take up multiple lines, add ellipsis option where user can click through to see more information.

I wrote a blog post covering some of these in a bit more detail: Accessible Text Scaling for Android

Sometimes, however, fixing it for all scenarios will involve rethinking the design.

For iOS, the font settings also affect all third-party apps, it's not just an Android thing.