【发布时间】: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