【发布时间】:2016-09-19 14:14:58
【问题描述】:
我正在使用 Xamarin 开发适用于 Android、iOS 和 Visual Studio 的应用程序
我在 xaml 中添加了以下几行以使用图像:
<Image Source="header.png" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" />
<Button x:Name="Object_Detection" Image="header.png" />
第一个用于在标题中显示图像,第二个用于显示按钮图标。它们链接到相同的图像“header.png”
我把图片放在: - Mobile.Droid\Resources\drawable - 移动.iOS\资源 -Mobile.Windows\资产
但图像在 Windows 8.1 应用程序中根本不显示。 图片尺寸为690*79。
如何解决问题?
【问题讨论】:
-
可以看这里:developer.xamarin.com/guides/xamarin-forms/working-with/images(注意构建操作选项和平台;))
-
他们没有注意将图像放置在 Windows 8.1 应用程序的位置
-
假设没有像您的“header.png”示例这样的文件夹,请将图像放在项目/应用程序的根目录中,并带有
Build Action: Content -
另请注意,在 Windows 上,按钮上的图像的行为与在 iOS 和 Android 上不同。在 Windows 上,它仍然是普通按钮,但在文本前面有一个小图标。在另外两个上,它类似于 Android 上的 ImageButton。
标签: c# visual-studio xaml xamarin xamarin.forms