【发布时间】:2021-04-18 11:25:41
【问题描述】:
我尝试使用 xamarin 在 android 项目中显示图像。
-
我把文件夹
Images放在我的android项目目录Resources/drawable/Images中 -
我从
BuildAction设置了每个图像属性AndroidResource(我不确定是否应该这样) -
在 c# 代码中,我尝试使用此代码调用图像,但对我不起作用:
if (descriptionForecast1 == "clear sky") { ImageDescriptionForecast1.Source = "Images/ClearSky.jpg"; ImageForecast1.Source = "Images/ClearSky.jpg"; }
我能否获得一个如何调用图像的示例,因为我收到这样的错误,即路径错误:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Aapt2.targets(3,3): Error APT2144: invalid file path '/Users/pizhev/Projects/WeatherLocationInfo 0.0.1/WeatherLocationInfo.Android/obj/Debug/res/drawable/images/lightrain1.jpg'. (APT2144) (WeatherLocationInfo.Android)
【问题讨论】:
-
查看文档local-images
-
有没有办法像我在 iOS 项目中那样称呼他们?