从零开始学Xamarin.Forms(三) Android 制作启动画面
<?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"/>
<?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(); } }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。