Xamarin(Android)制作启动画面

1、将启动图片保存到Drawable文件夹下

2、在Drawable文件夹下创建splashscreen.xml

<?xml version="1.0" encoding="utf-8" ?> 
<bitmap xmlns:android="http://schemas.android.com/apk/res/android" 
android:src="@drawable/splash_screen" 
android:gravity="fill" 
android:layout_gravity="center"/>

3、在android项目的 Resources 文件夹下添加“Values”文件夹,创建 Styles.xml,设置其创建内容如下:

<?xml version="1.0" encoding="utf-8" ?>
<resources>
  <style name="Theme.Splash"
    parent="android:Theme.Holo.Light">
    <item name="android:windowBackground">@drawable/splashscreen</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsTranslucent">false</item>
    <item name="android:windowIsFloating">false</item>
    <item name="android:backgroundDimEnabled">true</item>
  </style>
</resources>

4、在Android项目下创建一个SplashScreen.cs类

 [Activity(MainLauncher = true, NoHistory = true, Theme = "@style/Theme.Splash",
    ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class SplashScreen : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var intent = new Intent(this, typeof(MainActivity));
            StartActivity(intent);
            Finish();
        }
    }

 

Xamarin(Android)制作启动画面

上一篇:appium+Python第一个unitest


下一篇:Python爬虫也能用手机进行抓包?没错!这个技巧我只告诉你