我正在使用自定义单元格创建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>
IOS输出是:
答案 0 :(得分:1)
我刚刚将上面的代码更改为:
<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>