【问题标题】:Xamarin Forms not displaying images in MVVMCross MvxContentPageXamarin 表单未在 MVVMCross MvxContentPage 中显示图像
【发布时间】:2018-02-23 09:19:01
【问题描述】:

我无法在我的页面中查看任何本地图像。使用 android 作为参考,图像被正确放置在 Resources/Drawable 子文件夹中,但即使使用默认的“icon.png”也没有任何显示。

这是我的页面:

<?xml version="1.0" encoding="utf-8" ?>
<mvx:MvxContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                     xmlns:local="clr-namespace:MyApp"
                     xmlns:mvx="clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms"
                     x:Class="MyApp.MainPage"
                     BackgroundImage="icon.png">

    <StackLayout Orientation="Vertical">

        <Image Source="icon.png"></Image>
    </StackLayout>
</mvx:MvxContentPage>

这里是文件:

在构建输出中,我收到以下消息:

[0:] Could not load image named: {0}: icon.png

[0:] FileImageSourceHandler: Could not find image or image file was invalid: File: icon.png

我怀疑问题与使用 mvxContentPage 有关,因为更改为简单的 ContentPage 并使用 Gorilla 播放器预览图像按预期显示的页面。

提前致谢!

【问题讨论】:

  • 我有同样的问题。你找到解决办法了吗?
  • 我还没有真正找到解决方案,但我已经从 mvvmcross 转移到 FreshMVVM 并且问题没有出现。

标签: xaml xamarin xamarin.forms mvvmcross


【解决方案1】:

只需删除 (...).Android\bin 文件夹下的所有内容。 VS 将重新创建所有内容,这一次将包括新图像。

【讨论】:

    猜你喜欢
    • 2020-06-10
    • 1970-01-01
    • 1970-01-01
    • 2019-03-22
    • 2021-01-08
    • 2020-06-20
    • 1970-01-01
    • 2016-06-15
    • 2018-04-06
    相关资源
    最近更新 更多