我搜索了一下,发布在Xamarin论坛上,并在Slack上提问,但我还没有想出如何做到这一点。我也看了一堆Stackoverflow的帖子。如何在Xamarin Forms的StackLayout中放置一个正常运行的按钮?
我试图把一个按钮放在一个ScrollView.The图标的StackLayout只是一个测试图像。我知道它有比它需要更多的空间。我在C#中完成了这一切。
new StackLayout
{
Padding = 0,
Orientation = StackOrientation.Horizontal,
Children =
{
new Label
{
Text = "• ",
TextColor = Color.Black,
},
new Label
{
FontSize = 16,
Text = "Follow Surviving Sepsis Guidelines: ",
TextColor = Color.Black,
HorizontalOptions = LayoutOptions.Start
},
new WebView
{
HeightRequest = 100, WidthRequest = 100, Source = "https://developer.android.com/favicon.ico",
},
new Button
{
Text = "Surviving Sepsis Guidelines",
// Does not compile. "Invalid initializer member declarator"
Clicked += (sender,e) =>
{
Device.OpenUri(new Uri("http://www.sccm.org/Documents/SSC-Guidelines.pdf"));
}
},
}
},