![](/img/trans.png)
[英]How do you animate the outgoing transition of a splash screen in react native
[英]Animate or do a transition from bottom to top in splash screen in xamarin forms?
我試圖在初始屏幕的底部有一個帶有徽標的背景圖像。 在 ios 和 Android(xamarin 形式)中加載初始屏幕后,應該會發生從底部到中心的轉換。 請分享你的想法?
如果您想要 Animation 啟動畫面,請按照以下步驟操作。 我在 Android 中做了一個樣本。
首先,請創建 SplashScreen.axml。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView1"
android:src="@drawable/splash_logo"
android:gravity="bottom|center_horizontal"/>
</LinearLayout>
其次,在Resource文件夾下創建Anim文件夾,創建bottomtotop.xml animation關於翻譯。
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">
<translate
android:fromYDelta="100%p"
android:toYDelta="0"
android:duration="600"/>
</set>
第三,使用 animation 創建新的活動名稱 SplashScreenDemo.cs。 設置 MainLauncher = true。
[Activity(Label = "SplashScreenDemo", MainLauncher = true)]
public class SplashScreenDemo : Activity
{
ImageView imageView;
Animation view_animation;
TextView textview;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.SplashScreen);
imageView = FindViewById<ImageView>(Resource.Id.imageView1);
view_animation = AnimationUtils.LoadAnimation(this, Resource.Animation.bottomtotop);
imageView.StartAnimation(view_animation);
view_animation.AnimationEnd += Rotate_AnimationEnd;
// Create your application here
}
private void Rotate_AnimationEnd(object sender, Animation.AnimationEndEventArgs e)
{
// Finish();
Intent intent;
intent = new Intent(Application.Context, typeof(MainActivity));
StartActivity(intent);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.