xamarin / AndroidSupportComponents

Xamarin bindings for Android Support libraries - For AndroidX see https://github.com/xamarin/AndroidX
MIT License
146 stars 56 forks source link

Autosize Label TextCompat pre android 8 doesn't autosize text #241

Open AdamDiament opened 4 years ago

AdamDiament commented 4 years ago

Xamarin.Android Version (eg: 6.0):

7 and below have the issue. 8+ works as expected.

Operating System & Version (eg: Mac OSX 10.11):

Windows 10

Support Libraries Version (eg: 23.3.0):

using Android.Support.V4.Widget.TextViewCompat; (nuget package for compat not explicitly installed. I tried installing both v4 and v7 and it made no difference)

Describe your Issue:

TextViewCompat.SetAutoSizeTextTypeUniformWithConfiguration does not work as expected on android pre-8, when used in a custom renderer in a xamarin forms project. According to the docs it should provide backwards compatibility to android 4+. Font size should shrink as to not overflow the text bounds, it doesn't.

Steps to Reproduce (with link to sample solution if possible):

Sample solution zip: (rebuild as bin/obj folders were deleted). TestAutoSizeTextView.zip

  1. Rebuild the project and start on an Android 8 or higher device. The page loads and you see this screen with the text resizing correctly in the three labels with Aqua backgrounds.

image

  1. Load the same project on an android 7 device. The following behaviour is seen, text doesn't resize as expected.

image

Include any relevant Exception Stack traces, build logs, adb logs:

N/A