2

I am creating welcome screen in Xamarin shared application.Welcome screen has to show the image few seconds then navigate to login page.It is perfectly working in IOS, but not displaying image in Android.

 public Page()
    {


        //var beachImage = new Image { Aspect = Aspect.AspectFit };
        //beachImage.Source = ImageSource.FromFile("nextera.png");
        Image logo = new Image { WidthRequest = 800, HeightRequest = 800 };
        logo.Source = ImageSource.FromFile("nextera.png");
        logo.Aspect = Aspect.AspectFit;
        Content = new StackLayout
        {
            Children = { logo },
            Padding = new Thickness(0, 20, 0, 0),
            VerticalOptions = LayoutOptions.StartAndExpand,
            HorizontalOptions = LayoutOptions.CenterAndExpand

        };
        WaitAndExecute(2000);

    }

    private async Task WaitAndExecute(int milisec)
    {
        await Task.Delay(milisec);
        await Navigation.PushAsync(new Login());
    }

1 Answer 1

3

You need to add to the android project the file "nextera.png" to

Resources/drawable

 directory with Build Action: AndroidResource

A full guide for adding an image in Xamarin - Xamarin official guideline for loading a local image

Sign up to request clarification or add additional context in comments.

2 Comments

Sure. Did you managed to display the image using these actions?
Yes but with the code in the link that you provided

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.