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(); } }
黄山市民网:https://www.huangshanshimin.com/