Xamarin Forms Android Picker font size is different than Entry

The Xamarin Forms Android Picker font size is different than Entry font size and makes the forms look sloppy.

See attached image. Notice the iOS and UWP render the same font size for the controls.

Can you please fix this or make the Picker a MUCH better control?

Thanks!

Karl

Tagged:

Posts

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    @KarlShifflett
    Yes - unbelievable!
    I have just updated to Android 6.0.1 where the font now is incredible small (not usable).
    Then, I have wasted another hour of my life for searching, how I can set the font and ... surprise... it's not possible, as there is no property to set the fontsize!
    So... we have to implement a custom renderer (of course for each platform) to be able to set such a trivial thing as the fontsize (that seems to change depending to the Android version additionally).

    Shame on you Xamarin!

  • KarlShifflettKarlShifflett USMember ✭✭

    @FredyWenger yep, crazy stuff. Xamarin Forms needs a lot of work in the area of predictable and consistent rendering.

  • MaximTkMaximTk USMember ✭✭

    yes, this issue is presented in xamarin.forms.android for picker and datepicker controls. here is how you can change font size (use the same as for editor/entry controls)

    [assembly: ExportRenderer(typeof(ExtendedPicker), typeof(ExtendedPickerRenderer))]
    namespace Controls
    {
        class ExtendedPickerRenderer : PickerRenderer
        {
            protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
            {
                base.OnElementChanged(e);
    
                if (e.NewElement != null && Control != null)
                    Control.SetTextSize(Android.Util.ComplexUnitType.Sp, fontSize);
            }
        }
    }
    
  • NMackayNMackay GBInsider, University mod

    Yeah,

    had to make a render for the picker and a few other controls to sort the insane padding in AppCompat.

  • biaparbiapar ITMember ✭✭✭

    XAML and resource in app.xml?

Sign In or Register to comment.