【发布时间】:2020-12-13 05:35:19
【问题描述】:
我试图在初始屏幕中使用底部带有徽标的背景图像。一旦在 ios 和 Android(xamarin 表单)中加载初始屏幕,就会发生从底部到中心的转换。请分享您的想法?
【问题讨论】:
标签: android ios xamarin xamarin.forms xamarin-studio
我试图在初始屏幕中使用底部带有徽标的背景图像。一旦在 ios 和 Android(xamarin 表单)中加载初始屏幕,就会发生从底部到中心的转换。请分享您的想法?
【问题讨论】:
标签: android ios xamarin xamarin.forms xamarin-studio
如果你想动画启动画面,请按照以下步骤。我在 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关于翻译的动画。
<?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>
第三,创建新的活动名称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);
}
}
【讨论】: