【问题标题】:Xamarin.Forms can't display image in listXamarin.Forms 无法在列表中显示图像
【发布时间】:2018-07-12 10:45:32
【问题描述】:

我有一个 ListView,里面有几个项目。我在本地计算机上将应用程序作为 UWP 应用程序运行,但由于某种原因,通过 url 显示图像不起作用?

我使用的标签是

<Image Source="https://en.bitcoin.it/w/images/en/2/29/BC_Logo_.png" HeightRequest="20" WidthRequest="20" />

我曾尝试使用来自不同域的多个不同图像,因为我认为这可能是授权问题?但我尝试过的图片似乎都没有效果。

当我为图像定义空间时,列表中应该有一个间隙。

作为参考,这里是整个列表代码:

<ContentPage Title="Coins">
    <ContentPage.Content>
        <ListView x:Name="coins" HasUnevenRows="True">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <ViewCell.View>
                            <StackLayout Spacing="5" Orientation="Horizontal" Padding="10,10,10,10">
                                <Label Text="{Binding Path=Rank}" FontSize="10" VerticalTextAlignment="Center"/>
                                <Image Source="https://en.bitcoin.it/w/images/en/2/29/BC_Logo_.png" HeightRequest="20" WidthRequest="20" />
                                <Label Text="{Binding Path=Name}" TextColor="Black" FontSize="19" VerticalTextAlignment="Center"/>
                                <Label Text="{Binding Path=PercentChange24h, StringFormat='{0}%'}" VerticalTextAlignment="Center" TextColor="{Binding PercentTextColour}"/>
                                <Label Text="{Binding Path=LivePrice, StringFormat='${0}'}" VerticalTextAlignment="Center" HorizontalTextAlignment="End" HorizontalOptions="EndAndExpand"/>
                            </StackLayout>
                        </ViewCell.View>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </ContentPage.Content>
</ContentPage>

【问题讨论】:

    标签: xaml xamarin xamarin.forms


    【解决方案1】:

    这个问题归结为 UWP 无法显示图像,这适用于 Android 和 iOS。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-29
      • 2016-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-08
      相关资源
      最近更新 更多