Stack layout wont fit elements when large text is On

Published

I’m trying to make my app more compatible with accessibility features, and when a large text is enabled I cant fit two elements in a horizontally oriented stack. Any idea how I can fix this?

        StackLayout horisontalContainer = new StackLayout
        {
            Orientation = StackOrientation.Horizontal,
            HorizontalOptions = LayoutOptions.FillAndExpand,
        };

        List<string> dataList = this.registerCountries();
        List<string> numberList = this.registerAreaCodes();
        List<string> pickerData = new List<string>();
        int i = 0;
        foreach (var data in dataList)
        {
            pickerData.Add(data + " +" + numberList[i]);
            i++;
        }

        countryCode = new Picker { Title = "Country code" };
        countryCode.ItemsSource = pickerData;
        countryCode.IsEnabled = true;
        countryCode.SelectedIndex = 0;
        countryCode.SelectedIndexChanged += (sender, args) =>
        {
            var tempValue = countryCode.Items[countryCode.SelectedIndex];
            string[] words = tempValue.Split('+');
            pickerSelection = words[words.Length-1];
        };

        phoneNbrEntry = new Entry
        {
            Placeholder = Localization.MobileNumber,
            FontSize = 18,
            BackgroundColor = Color.White.ToFormsColor(),
            TextColor = Color.Black.ToFormsColor(),
            Keyboard = Keyboard.Telephone,
        };

#if IOS
phoneNbrEntry.WidthRequest = UIKit.UIScreen.MainScreen.Bounds.Width/2-20;
#endif

#if ANDROID
phoneNbrEntry.WidthRequest = CrossScreen.Current.Size.Width/2-20;
#endif

        horisontalContainer.Children.Add(countryCode);
        horisontalContainer.Children.Add(phoneNbrEntry);

Images:
Enlarged text
Normal

Source: Xamarin.ios Questions

Published
Categorised as Uncategorised Tagged , , , ,

Answers

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq