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());
}
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
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.