xamarin形式:具有Stacklayout的FlexLayout,stacklayout中的项未垂直居中

时间:2019-03-25 07:59:39

标签: xamarin layout flexbox stacklayout

我在列中有一个flexLayout方向。在FlexLayout中,我放置了6个stackLayout,每个布局将在其中放置一个图像。我需要将6张图片放置在stacklayout中。它会在堆栈布局的开头而不是居中显示布局堆栈。

<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>

我如何使项目位于堆栈布局内部

0 个答案:

没有答案