Xaml ListView在iOS上未正确显示

Xaml ListView在iOS上未正确显示,xaml,xamarin,xamarin.forms,xamarin.ios,Xaml,Xamarin,Xamarin.forms,Xamarin.ios,我正在编写Xamarin表单应用程序,它在列表视图中显示用户的评论 问题是它在Android上显示正确,但在iOS上却完全是开箱即用(如屏幕截图所示) 这些项目是在异步web请求收集信息后添加的,我不知道这是否会影响它 Android屏幕 iOS屏幕 我的XAML PostViewCell.cs 使用SocialNetwork.iOS.renders; 使用SocialNetwork.renders; 使用UIKit; 使用Xamarin.Forms; 使用Xamarin.Forms.P

我正在编写Xamarin表单应用程序,它在列表视图中显示用户的评论

问题是它在Android上显示正确,但在iOS上却完全是开箱即用(如屏幕截图所示)

这些项目是在异步web请求收集信息后添加的,我不知道这是否会影响它

Android屏幕

iOS屏幕

我的XAML


PostViewCell.cs

使用SocialNetwork.iOS.renders;
使用SocialNetwork.renders;
使用UIKit;
使用Xamarin.Forms;
使用Xamarin.Forms.Platform.iOS;
[程序集:ExportRenderer(typeof(PostViewCell)、typeof(PostViewCelliOS))]
命名空间SocialNetwork.iOS.Renderers
{
公共类PostViewCelliOS:ViewCellRenderer
{
公用覆盖UIKit.UITableViewCell GetCell(单元格项,UIKit.UITableViewCell可重用单元格,UIKit.UITableView tv)
{
var cell=base.GetCell(item、reusableCell、tv);
cell.SelectionStyle=UITableViewCellSelectionStyle.None;
返回单元;
}
}
}

您可以尝试创建一个堆栈布局来包装您的内容,如:

<local:PostViewCell>
    <StackLayout>
        <StackLayout x:Name="MessageLayout" BackgroundColor="White" Margin="10, 10, 10, 10" Padding="10, 10, 15, 10">
            <Image Source="options_icon.png" HeightRequest="18" HorizontalOptions="End" Margin="5, 0, 5, 0" IsVisible="{Binding ShowBanners}">
                <Image.GestureRecognizers>
                    <TapGestureRecognizer Command="{Binding OptionClick}" CommandParameter="{Binding .}"/>
                </Image.GestureRecognizers>
            </Image>
            <Label Text="{Binding Body}" HorizontalOptions="CenterAndExpand" TextColor="{Binding BodyColor}" FontSize="15" Margin="0, 10, 0, 10"/>
            <StackLayout x:Name="MessageFooter" Orientation="Horizontal" IsVisible="{Binding ShowBanners}">
                <Image x:Name="LikeSource" Source="{Binding LikeImageSource}" HeightRequest="20" HorizontalOptions="StartAndExpand" Margin="0, 0, 10, 0">
                    <Image.GestureRecognizers>
                        <TapGestureRecognizer Command="{Binding LikeClick}" CommandParameter="{Binding .}"/>
                    </Image.GestureRecognizers>
                </Image>
                <Label Text="{Binding Timestamp}" TextColor="Black" FontSize="10" HorizontalOptions="EndAndExpand"/>
            </StackLayout>
        </StackLayout>
    </StackLayout>
</local:PostViewCell>


“一切乱七八糟”不是对问题的有用描述。@Jason编辑并添加了详细信息。请为每个StackLayout添加不同的背景色,以便您知道哪个是有问题的。另外,尝试使用网格而不是堆叠堆栈布局。@Rodrige。我不认为网格可以修复它,当设置背景颜色时,我可以看到它脱离了布局。你可以发布你的
PostViewCell
的代码吗?