如何在 xamarin 中设置帧边距?

Sru*_*kar 6 listview xamarin.forms

我正在使用自定义单元格创建 Listview。我在 Viewcell 中使用 Frame。它在 Android 设备中显示良好,但在 IOS 中它不显示两帧之间的边距。我如何为 IOS 设置这个?

Viewcell的代码是:

 <ViewCell>
    <StackLayout>
      <Frame Margin="10" BackgroundColor="White" CornerRadius="5" HasShadow="False"  IsClippedToBounds="False">
       <StackLayout>
          <Label Text="{Binding Name}" FontFamily="Raleway-Regular" FontSize="24" TextColor="#262628" HorizontalTextAlignment="Center" FontAttributes="Bold"></Label>
          <Label Text="{Binding Description1}" FontSize="15" HorizontalTextAlignment="Center" TextColor="#262628" FontAttributes="Bold" Margin="0,5"></Label>
          <ContentView HorizontalOptions="Center"  Padding="0" Content="{Binding IngredientsArray1, Converter={StaticResource arrayToStackLayout}}" />
       </StackLayout>
      </Frame>
     </StackLayout>
 </ViewCell>
Run Code Online (Sandbox Code Playgroud)

IOS 输出是:

图片

Sru*_*kar 3

我刚刚将上面的代码更改为:

 <ViewCell>
                <ContentView>
                    <Frame Margin="10" BackgroundColor="White" CornerRadius="5" HasShadow="False"  IsClippedToBounds="True">
                        <StackLayout Margin="5">
                            <Label Text="{Binding Name}" FontFamily="Raleway-Bold" FontSize="24" TextColor="#262628" HorizontalTextAlignment="Center" FontAttributes="Bold"></Label>
                            <Label Text="{Binding Description1}" FontSize="15" HorizontalTextAlignment="Center" TextColor="#262628" FontAttributes="Bold" Margin="0,5"></Label>
                            <ContentView HorizontalOptions="Center"  Padding="0" Content="{Binding IngredientsArray1, Converter={StaticResource arrayToStackLayout}}" />
                        </StackLayout>
                    </Frame>
                </ContentView>
            </ViewCell>
Run Code Online (Sandbox Code Playgroud)