xamarin.forms-我的StackLayout出现布局问题

问题描述 投票:0回答:1

我像这样使用xamarin.forms StackedLayout:

<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand">

    <StackLayout Margin="5,0,5,0" HorizontalOptions="FillAndExpand">
        <Entry x:Name="Community" WidthRequest="200" Placeholder="Community" />
        <Entry x:Name="Job" WidthRequest="200" Placeholder="Job" />
        <Entry x:Name="Model" WidthRequest="200" Placeholder="Model" />
        <Entry x:Name="Elevation" WidthRequest="200" Placeholder="Elevation" />
        <Entry x:Name="Email" WidthRequest="200" Placeholder="Email" />
        <Entry x:Name="C_Email" WidthRequest="200" Placeholder="C_Email" />
        <Entry x:Name="Buyer_Salutation" WidthRequest="200" Placeholder="Buyer_Salutation" />
        <Button x:Name="FrontCamera" Text="Front Licence" Clicked="OnFrontCamera" Style="{StaticResource ButtonStyle}" />
    </StackLayout>
    <StackLayout Margin="5,0,5,0" HorizontalOptions="FillAndExpand">

        <Entry x:Name="Customer_Name" WidthRequest="200" Placeholder="Customer_Name" />
        <Entry x:Name="Customer_LName" WidthRequest="200" Placeholder="Customer_LName" />
        <Entry x:Name="C_Buyer_Salutation" WidthRequest="200" Placeholder="C_Buyer_Salutation" />
        <Entry x:Name="CoBuyer_Name" WidthRequest="200" Placeholder="CoBuyer_Name" />
        <Entry x:Name="CoBuyer_LName" WidthRequest="200" Placeholder="CoBuyer_LName" />
        <Entry x:Name="Address1" WidthRequest="200" Placeholder="Address1" />
        <Entry x:Name="City" WidthRequest="200" Placeholder="City" />
        <Button x:Name="BackCamera" Text="Back Licence" Clicked="OnBackCamera" Style="{StaticResource ButtonStyle}" />

    </StackLayout>
    <StackLayout Margin="5,0,5,0" HorizontalOptions="FillAndExpand">

        <Entry x:Name="Phone1Cell" WidthRequest="200" Placeholder="Phone1Cell" />
        <Entry x:Name="Phone1Work" WidthRequest="200" Placeholder="Phone1Work" />
        <Entry x:Name="Phone2Main" WidthRequest="200" Placeholder="Phone2Main" />
        <Entry x:Name="Phone2Cell" WidthRequest="200" Placeholder="Phone2Cell" />
        <Entry x:Name="Phone2Work" WidthRequest="200" Placeholder="Phone2Work" />
        <Entry x:Name="Province" WidthRequest="200" Placeholder="Province" />
        <Entry x:Name="Zip" WidthRequest="200" Placeholder="Zip" />
        <Button x:Name="ScanLicence" Text="Scan Licence" Clicked="OnCameraScan" Style="{StaticResource ButtonStyle}" />
        <zxing:ZXingScannerView x:Name="BarcodeScanView" IsVisible="false" HeightRequest="200" OnScanResult="Handle_OnScanResult" />

    </StackLayout>

</StackLayout>

哪个工作很棒!我有3个StackLayout并排,这正是我想要的,现在我想添加另一个3个StackLayouts下方的StackLayout,我该怎么做?我尝试添加第4个StackLayout,但它继续并排运行,而不是在3个StackLayout之下都没有...这是我要添加的第4个StackLayout ...

<StackLayout HorizontalOptions="FillAndExpand">
        <Button x:Name="GenerateContract" Text="Generate Contract" Clicked="OnGenerateContract" Style="{StaticResource ButtonStyle}" />
    </StackLayout>

我该如何解决?

c# xamarin.forms
1个回答
0
投票

您需要添加另一个包含水平的垂直StackLayout

© www.soinside.com 2019 - 2024. All rights reserved.