XAML 为什么Maui AbsoluteLayout在StackLayout中不显示内容

mccptt67  于 2023-03-21  发布在  其他
关注(0)|答案(1)|浏览(198)

我在使用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>
a6b3iqyw

a6b3iqyw1#

这与StackLayout无关,您只需将AbsoluteLayout.LayoutFlags="All"更改为AbsoluteLayout.LayoutFlags="None"

相关问题