Step1:
Page1.Xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TwitterAimation.Page1">
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin Forms!" HorizontalOptions="Center" VerticalOptions="Center" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
Step2: SplashPage:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using Xamarin.Forms;
namespace TwitterAimation
{
public class SplashPage : ContentPage
{
Image splashImage;
public SplashPage()
{
NavigationPage.SetHasNavigationBar(this, false);
var sub = new AbsoluteLayout();
splashImage = new Image
{
Source = "Twitter.png",
WidthRequest = 100,
HeightRequest = 100
};
AbsoluteLayout.SetLayoutFlags(splashImage,
AbsoluteLayoutFlags.PositionProportional);
AbsoluteLayout.SetLayoutBounds(splashImage,
new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
sub.Children.Add(splashImage);
this.BackgroundColor = Color.FromHex("#429de3");
this.Content = sub;
}
protected override async void OnAppearing()
{
base.OnAppearing();
await splashImage.ScaleTo(1, 2000); //Time-consuming processes such as initialization
await splashImage.ScaleTo(0.9, 1500, Easing.Linear);
await splashImage.ScaleTo(150, 1200, Easing.Linear);
Application.Current.MainPage = new NavigationPage(new Page1()); //After loading MainPage it gets Navigated to our new Page
}
}
}
Step3: Holaaa Steps Complete Enjoy Friends :D
Wonderful work, Keep great work up. Really helpful.
ReplyDeletei got exception Unhandled Exception:
ReplyDeleteSystem.InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
Please advise