将图像放置在Xamarin表单应用程序的位置 [英] where to put images for xamarin forms application

查看:118
本文介绍了将图像放置在Xamarin表单应用程序的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Xamarin开发适用于Android,iOS和Visual Studio的应用程序

I am developing an application for Android, iOS and Visual Studio using Xamarin

我在xaml中添加了以下几行以使用图片:

I added the following lines in xaml to use images:

<Image Source="header.png" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" />
<Button x:Name="Object_Detection" Image="header.png" />

第一个用于显示标题中的图像,第二个用于显示按钮图标.他们链接到同一张图片"header.png"

The first is for displaying an image in the header and the second is for displaying a button icon. They link for the same image "header.png"

我将图片放在以下位置: -Mobile.Droid \ Resources \ drawable -Mobile.iOS \资源 -Mobile.Windows \ Assets

I put the image under: - Mobile.Droid\Resources\drawable - Mobile.iOS\Resources -Mobile.Windows\Assets

但是Windows 8.1应用程序中根本没有显示图像. 图片尺寸为690 * 79.

But the image is not shown at all in the Windows 8.1 app. the image size is 690*79.

如何解决该问题?

推荐答案

感谢您的所有帖子,

解决方案是将图像资源直接添加到根目录下的Windows子项目中.

the solution was to add the image resource to the windows sub-project directly under the root.

应该使用Visual Studio进行添加,以便编译器可以考虑图像.

The addition should be made using visual studio so that the image will be taken in consideration by the compiler.

这篇关于将图像放置在Xamarin表单应用程序的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆