我有一段很长的文字,想要显示出来。我使用了一个标签。但是这个标签不能完全显示所有文字。我想让这个标签有一个垂直滚动条。
Grid mainGrid = new Grid
{
HeightRequest = 40,
BackgroundColor = Color.White,
Padding = 20,
RowDefinitions =
{
new RowDefinition { Height = new GridLength(25, GridUnitType.Star) },//0 Title
new RowDefinition { Height = new GridLength(5, GridUnitType.Star) },//1 Line
new RowDefinition { Height = new GridLength(50, GridUnitType.Star) },//2 This is for MessageLabel
new RowDefinition { Height = new GridLength(20, GridUnitType.Star) },//3 OK-Cancel
}
};
MessageLabel = new Label
{
FontAttributes = FontAttributes.None,
FontSize = 18,
HorizontalTextAlignment = TextAlignment.Start,
VerticalTextAlignment = TextAlignment.Center,
HorizontalOptions = LayoutOptions.StartAndExpand,
TextColor = Color.Black,
};
mainGrid.Children.Add(MessageLabel, 0, 2);
我尝试了不同的VerticalOptions
来尝试调整这个标签的位置,但是没有任何效果。
如果对于标签来说这是不支持的,那么我可以使用其他控件吗?