Android Example Resizing Text Control Custom View - Set text control size based on text - Non Latin Text fix

There are many occasions when you need to have multiple labels which all size themselves to their contents and also align with each other with no space.

The solution to this is to use MeasureMultiLineText within the StringUtils Library.

To make this easy to use I created a CustomView, ResizingTextControl which you can add to a custom list view or other container and it will resize to its contents.

and made this available to the community.


However, on Android, there is a subtle problem using this which occurs with certain fonts on certain phones. MeasureMultiLineText does not appear to work correctly and calculates the wrong size and the text appears clipped.



@KZero found the solution.

It seems that non latin text may not display correctly unless you set the SetFallbackLineSpacing to False.


Doing this resolves the clipping problem.



Attached is an updated version of the Custom View which incorporates the fix.

You need Phone and Reflection to use on Android.

Selecting the FLS TRUE or FALSE will set the FallBackLineSpacing to TRUE or FALSE and you can see the difference.
 

Attachments

  • clvwithresizingtextupdated.zip
    369.8 KB · Views: 183

Soheyl

Member
Licensed User
Longtime User

Fantastic, Now it's working like a charm...
Thank you, Andrew ; )
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…