Divya
Divya

Reputation: 1213

Image is not visible in android project with XAML forms - Xamarin even though provided solutions applied

I tried solutions from the following links but none worked.

where-to-put-images-for-xamarin-froms-application

developer.xamarin.com/guides/xamarin-forms/user-interface/images/#Local_Images

image-not-showing-in-xamarin-forms-app.html

I used below syntax

<Image Source="lock.png" HeightRequest="20" WidthRequest="20" HorizontalOptions="Center" VerticalOptions="Center"  Grid.Row="0" Grid.Column="0"></Image>

Here is the image for where i've kept image

resource where Image is placed

No image displays

enter image description here

Edit

enter image description here

enter image description here

These are the only things in my XAML page.

Upvotes: 2

Views: 317

Answers (3)

W0RT4
W0RT4

Reputation: 458

In my case I need to use method Forms.Init(Context activity, Bundle bundle), in my SplashScreen OnCreate method and Activity class OnCreate method. But it also important that images build action properties is set on AndroidResource.

Upvotes: 0

Divya
Divya

Reputation: 1213

In my case the issue was of assembly. when trying all the possible solutions like

1.) Changing Build Action

2.) Adding Image to all the folders within Resources

Image

3.) Naming Convention should not include - in File/Image Name.

4.) Changing Background Color

I also got one solution while searching for embedded Images that assembly was missing here.

Image2

This change worked for me in using Local Images. Got that solution from this link

Upvotes: 3

Abdullah
Abdullah

Reputation: 955

Right click the lock.png image and see if there is an option "include in project"

If there is, project cannot find image

Upvotes: 0

Related Questions