I am developing a Cross-Platform
app in Xamarin Visual Studio 2019 and having issues with image display.
I am trying to show an image with the following XAML
code.
<StackLayout Grid.Row="0" Grid.Column="0" Spacing="0" >
<Image
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand"
Source="logo"
WidthRequest="{OnPlatform iOS=300, Android=250}">
</Image>
</StackLayout>
Problem is image not displaying on either preview or deployed app
.
I took references from multiple forums including help from StackOverflow but couldn't tackle the issue.
Here are the points and methods I worked on to resolve the issue.
- The file named
logo
is an android resource folder and is a proper.png
file. - Property for the file is set to
AndroidResource
. As per answers posted here, Xamarin Images not showing, file name does not have a hyphen in it, and also tried other posted answers on the same page.
Image size 307X80 pixels so it's well within range for memory or size.
Android Drawable folder also contain default xamarin_logo.png
image and that file works fine. But not newly added images. Is there anything I am missing here to add these image files to the solution?