【问题标题】:Xamarin forms: How to place listview on top of an image?Xamarin 表单:如何将列表视图放在图像顶部?
【发布时间】:2020-07-19 06:46:26
【问题描述】:

我的项目中有一个flowlistview,我需要将它放在图像上。 以下是我的 XAML 代码:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <Image Aspect="AspectFill" HorizontalOptions="FillAndExpand" Grid.Row="0" Source="ic_background_image_xx.png"/>

    <flv:FlowListView 
        Grid.Row="0">
        <flv:FlowListView.FlowColumnTemplate>
            <DataTemplate>
                <StackLayout> 

                </StackLayout>
            </DataTemplate>
        </flv:FlowListView.FlowColumnTemplate>
    </flv:FlowListView>
</Grid>

此代码在 android 设备上运行良好,并且 listview 放置在绿色背景图像之上。 但在 ios 中,此功能不起作用。请通过下面的屏幕截图并提出适用于 ios 的解决方案。

【问题讨论】:

    标签: image listview xamarin.forms


    【解决方案1】:

    原因:iOS 中的 ListView 有默认的 BackgroundColor(白色),而 Android 中 ListView 的背景颜色是透明的。

    所以你只需要将FlowListView的BackgroundColor设置为透明

    <flv:FlowListView   
            BackgroundColor="Transparent"
            Grid.Row="0">
    

    【讨论】:

      【解决方案2】:

      为此,您需要为图像设置Grid.RowSpan="2"

      【讨论】:

        猜你喜欢
        • 2019-08-17
        • 2018-03-14
        • 1970-01-01
        • 2018-06-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多