我在使用AbsoluteLayout时遇到了一个.NET Maui应用程序的问题,页面上什么都没有显示。我只得到了一个空白页面。
代码如下所示。
需要注意的是,最上面的StackLayout来自母版页,所以我不能删除它。但是,问题出现在下面的代码中。
谢谢
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" >
<AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<ScrollView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" AbsoluteLayout.LayoutBounds="0,0,AutoSize, AutoSize" AbsoluteLayout.LayoutFlags="All">
<VerticalStackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="Welcome to .NET MAUI!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="More labels!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="More labels!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="More labels!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="More labels!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="More labels!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="More labels!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="More labels!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="More labels!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="More labels!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="More labels!" VerticalOptions="Start" HorizontalOptions="Start" />
<Label Text="More labels!" VerticalOptions="Start" HorizontalOptions="Start" />
</VerticalStackLayout>
</ScrollView>
</AbsoluteLayout>
</StackLayout>
1条答案
按热度按时间a6b3iqyw1#
这与StackLayout无关,您只需将
AbsoluteLayout.LayoutFlags="All"
更改为AbsoluteLayout.LayoutFlags="None"