首页 文章

无法以xamarin形式显示图像

提问于
浏览
0

我试图 Build 一个简单的应用程序来显示堆栈布局中的图像,这是代码

<?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>

但由于某种原因,它根本没有显示图像 . 你们任何人都可以在这里看错 .

谢谢!!

1 回答

  • 0

    可能你没有一个结构良好的页面?

    <?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,其中包含应用程序的本地命名空间 . 您可能没有完全形成的页面,导致它甚至无法正确加载 .

    这对我很有用 .

相关问题