Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin 使用FlexLayout wrap,如何在行之间留出空间?_Xamarin_Xamarin.forms - Fatal编程技术网

Xamarin 使用FlexLayout wrap,如何在行之间留出空间?

Xamarin 使用FlexLayout wrap,如何在行之间留出空间?,xamarin,xamarin.forms,Xamarin,Xamarin.forms,我正在使用FlexLayout尝试使按钮环绕。它可以工作,但按钮行之间并没有空间 有人知道我怎样才能确保两者之间有一个空间吗。下面是我正在使用的XAML,下面是它的外观: <StackLayout Orientation="Vertical" BackgroundColor="{DynamicResource GridBackgroundColor}" Spacing="0" Padding="20" &g

我正在使用FlexLayout尝试使按钮环绕。它可以工作,但按钮行之间并没有空间

有人知道我怎样才能确保两者之间有一个空间吗。下面是我正在使用的XAML,下面是它的外观:

<StackLayout Orientation="Vertical" 
             BackgroundColor="{DynamicResource GridBackgroundColor}" 
             Spacing="0" 
             Padding="20" >
    <FlexLayout x:Name="flexLayout"
        Wrap="Wrap"
        JustifyContent="SpaceAround" >
        <Button BackgroundColor="Silver" Padding="10" Margin="5" Text="Introduction" />
        <Button BackgroundColor="Silver" Padding="10" Margin="5" Text="Learning" />
        <Button BackgroundColor="Silver" Padding="10" Margin="5" Text="Home" />
        <Button BackgroundColor="Silver" Padding="10" Margin="5" Text="Help" />
        <Button BackgroundColor="Silver" Padding="10" Margin="5" Text="Settings" />
        <Button BackgroundColor="Silver" Padding="10" Margin="5" Text="Dictionary" />
        <Button BackgroundColor="Silver" Padding="10" Margin="5" Text="Cards" />

    </FlexLayout>
</StackLayout>


解决方案:

尝试添加
按钮的
高度请求
和/或
宽度请求

 <ContentPage.Resources>
            <Style TargetType="Button">
                <Setter Property="HeightRequest" Value="40"></Setter>
                <Setter Property="Margin" Value="5"></Setter>
            </Style>

        </ContentPage.Resources>

        <StackLayout Orientation="Vertical" 
                 BackgroundColor="{DynamicResource GridBackgroundColor}" 
                 Spacing="0" 
                 Padding="20">
            <FlexLayout
                            Wrap="Wrap"
                            JustifyContent="SpaceAround" 
                            Direction="Row">
                <Button BackgroundColor="Silver"   Text="Introduction" />
                <Button BackgroundColor="Silver"  Text="Learning" />
                <Button BackgroundColor="Silver"   Text="Home" />
                <Button BackgroundColor="Silver"   Text="Help" />
                <Button BackgroundColor="Silver"   Text="Settings" />
                <Button BackgroundColor="Silver"  Text="Dictionary" />
                <Button BackgroundColor="Silver"   Text="Cards" />

            </FlexLayout>
        </StackLayout>