0

我有一个列方向的 FlexLayout。在 FlexLayout 中,我放置了六个 StackLayout,每个都包含一个图像。

我需要将六个图像放在 StackLayouts 的中心,而不是现在在开始时显示。

<FlexLayout Direction="Column" VerticalOptions="Fill" HorizontalOptions="Fill">
    <StackLayout FlexLayout.Grow="1" BackgroundColor="#EBF6FD">
        <StackLayout.GestureRecognizers>
            <TapGestureRecognizer Command="{Binding TimeSheetCommand, Source={x:Reference page}}"></TapGestureRecognizer>
        </StackLayout.GestureRecognizers>

        <ImageButton VerticalOptions="Center" HorizontalOptions="Center"  BackgroundColor="Transparent" Source="timesheet.png" Command="{Binding TimeSheetCommand, Source={x:Reference page}}"></ImageButton>
        <Label VerticalOptions="Center" HorizontalOptions="Center" Text="{x:Static resources:Resources.TitleTimeSheet}" Style="{StaticResource primaryNormalTextStyle}" TextColor="#7CB4DD"></Label>
    </StackLayout>

    <StackLayout FlexLayout.Grow="1" BackgroundColor="#EBF6FD">
        <StackLayout.GestureRecognizers>
            <TapGestureRecognizer Command="{Binding TimeSheetCommand, Source={x:Reference page}}"></TapGestureRecognizer>
        </StackLayout.GestureRecognizers>

        <ImageButton VerticalOptions="Center" HorizontalOptions="Center"  BackgroundColor="Transparent" Source="timesheet.png" Command="{Binding TimeSheetCommand, Source={x:Reference page}}"></ImageButton>
        <Label VerticalOptions="Center" HorizontalOptions="Center"  Text="{x:Static resources:Resources.TitleTimeSheet}" Style="{StaticResource primaryNormalTextStyle}" TextColor="#7CB4DD"></Label>
    </StackLayout>

如何在 StackLayout 中将项目居中?

4

0 回答 0