【发布时间】:2020-11-24 11:28:35
【问题描述】:
我正在尝试使我的应用程序与辅助功能更兼容,但当启用大文本时,我无法在水平方向的堆栈中容纳两个元素。知道如何解决这个问题吗?
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 安卓 phoneNbrEntry.WidthRequest = CrossScreen.Current.Size.Width/2-20; #endif
horisontalContainer.Children.Add(countryCode);
horisontalContainer.Children.Add(phoneNbrEntry);
【问题讨论】:
-
现在可以用了吗?
-
@LucasZhang-MSFT 是的。我希望有一个堆栈解决方案,但我确实将其更改为网格
标签: c# xaml xamarin xamarin.forms xamarin.ios