Android Question B4A UI problem when a text is scaled.


Well-Known Member
Licensed User
I enrolled an app in Google play open beta testing. Google sent me prelaunch report and it got me worried.
On devices where user increases the display font size, my labels and other views overlap (cropped) each other.

I tested some other apps and they are able to adjust and even wrap content. Only my B4A appss are cropping.
Out of curiosity, i also opened B4A Bridge App and it also have labels overlaping when scalled.

Google report Recommendation
This TextView has a fixed size and scalable text.
Consider modifying the LayoutParams to allow for text expansion.
"wrap_content" or "match_parent" is preferred for the dimensions of a TextView or a non-scrolling container of scalable text.

More information from link below gave ways of correct implementation. Chere spoiler

Text scaling​

To support different screen sizes, screen orientations, pixel densities, and font sizes, Accessibility Scanner looks for places where text doesn’t scale.
Some users have difficulty when they read texts that are small. They can use their device's Font size Accessibility setting to make text larger on the screen. However, this setting only affects the appearance of text if its font size was specified in units of scalable pixels (sp).
When you adjust the font size to make text appear larger, the increased size may cause parts of the text to become cropped, cut, or obscured if the layout is overly constrained. "wrap_content" or "match_parent" is preferred for the dimensions of a TextView or a non-scrolling container of scalable text.


Text sizes are defined in scalable pixels (sp).

Good examples:​

android:text="@string/directions" />

Text with size in sp, and height that allows expansion.

android:text="@string/directions" />

Height allows expansion, but will be at least 48dp.

Bad examples:​

android:text="@string/directions" />

Text with a size in density-independent pixels (dp) won't scale.

android:text="@string/directions" />

Text with a fixed width and height might not provide sufficient room for enlarged content, potentially causing text to be clipped when scaled.


When you design a user interface, you should:
  • Define text sizes in units of scale-independent pixels (sp), not dp, px, or others.
  • Avoid using tiny text that's difficult for some users to read.
  • Avoid text content with a fixed height and width. Prefer responsive layouts that can readily accommodate different screen sizes, screen orientations, pixel densities, and font sizes.


When you test your app, consider these test scenarios:
  • Increase the Accessibility "Font size" to its largest setting.
  • Test the app and verify that:
    • All the text is displayed correctly.
    • Texts have become larger, especially any text that was initially small.
  • While the Font size is enlarged, view each screen in both Portrait and Landscape, if available.

Give feedback about this article

Two things
1. "wrap_content" or "match_parent" is preferred
2. Text sizes are defined in scalable pixels (sp) instead of dp

If these already work in B4A, then someone should point me in the right direction, else the question is How do we utilize these to make better UI for our apps?
Is the solution calculating the system font and adjusting our views as it changes?

Please advice





Many apps will not look perfect and will truncate some of the text with these settings. This is not something specific to B4A.

It is also not really recommended to disable the effect of this scaling as the user will likely not be able to read the text.

Hello community,

I'm facing a similar issue as explained in this post while implementing my apps on smartphones with different screen sizes and resolutions. Is B4X capable to implement the scalable pixels (sp) concept for text outputs?

Look here ...

If the concept is not implemented in BX4, what is your recommended workaround?

Upvote 0