繁体   English   中英

无法以Xamarin形式显示图像

[英]cannot display image in xamarin forms

我正在尝试构建一个简单的应用程序以堆栈布局显示图像,这是代码

  <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="HelloWorld.Page1">
  <StackLayout BackgroundColor="White">
    <Image Source="http://placehold.it/300x300"/>
  </StackLayout>
</ContentPage>

但由于某种原因,它根本不显示图像。 你们中的任何人都能在这里看到问题吗?

谢谢!!

可能您的页面格式不正确?

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:QuickTestXAMLImage"
             x:Class="QuickTestXAMLImage.MainPage">

  <StackLayout BackgroundColor="White">
    <Image Source="http://placehold.it/300x300"/>
  </StackLayout>

</ContentPage>

请注意,我有一个xmlns:local,其中包含应用程序的本地名称空间。 您可能没有完整的页面,导致页面甚至无法正确加载。

这对我来说很好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM