I trying to display a images in android project using xamarin.
I put folder Images
in my android project in directory Resources/drawable/Images
I set on every image property AndroidResource
from BuildAction
(I'm not sure if that should be the case)
In the c# code I try to call the image with this code but not worked for me:
if (descriptionForecast1 == "clear sky") { ImageDescriptionForecast1.Source = "Images/ClearSky.jpg"; ImageForecast1.Source = "Images/ClearSky.jpg"; }
Can I get an example of how to call the Images, because I get an error like this that the path is wrong:
/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)
from the docs
Android - Place images in the Resources/drawable directory with Build Action: AndroidResource. High- and low-DPI versions of an image can also be supplied (in appropriately named Resources subdirectories such as drawable-ldpi, drawable-hdpi, and drawable-xhdpi).
do not create your own sub-folders in Resources
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.