Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to use TextView.SetAutoSizeTextTypeUniformWithConfiguration on Android 6.0.1?

JohnHardmanJohnHardman GBUniversity admin

In a custom renderer and in an effect, both on Android, I make use of TextView.SetAutoSizeTextTypeUniformWithConfiguration

On a Samsung Galaxy J5 running Android 6.0.1 this is resulting in a Java.Lang.NoSuchMethodError exception.

I believe that TextView.SetAutoSizeTextTypeUniformWithConfiguration was introduced in Oreo. However, according to , using the V26 (and I assume any later) support libraries should add support for TextView.SetAutoSizeTextTypeUniformWithConfiguration in Android 4.0 and later (I am interpreting the wording on that page, as the English is a little dodgy).

Exactly what is says is:

First, you have to add the support library v26 or more in your build.gradle file.
implementation ''
implementation ''
Although, it has been introduced in Android Oreo, but through using support library, this feature is backward compatible upto the Android 4.0 and later.

In my Xamarin.Forms app, I add the following NuGets:

but still it reports Java.Lang.NoSuchMethodError on Android 6.0.1.

What else do I need to do to get that method supported?

Best Answer


  • JohnHardmanJohnHardman GBUniversity admin

    Thanks @Jarvan

    I was already using Xamarin.Android.Support.v4 but I hadn't realised that


    needed to be replaced by

    TextViewCompat.SetAutoSizeTextTypeUniformWithConfiguration(Control, 10, 18, 10, (int) ComplexUnitType.Sp);

    Many thanks

  • JohnHardmanJohnHardman GBUniversity admin


    Ah, it seems that it doesn't work after all. It does build, but testing the following on my Samsung phone running Android 6.0.1

        (int)(Device.GetNamedSize(NamedSize.Large, typeof(Label)) * 2.0),

    does not have the same result as running the following on a Motorola running Android 9

        (int)(Device.GetNamedSize(NamedSize.Large, typeof(Label)) * 2.0),

    The Motorola running Android 9 does what I would expect, the Samsung running 6.0.1 does not.

  • clevertreeclevertree Member ✭✭
    edited July 12

    @Jarvan did you get any further with this? Android 7 and downwards isn't working properly - the font appears too small for me. See full description in my SO question

Sign In or Register to comment.