显示白色屏幕的Xamarin表格显示在启动屏幕之前

7xzttuei  于 2022-12-07  发布在  其他
关注(0)|答案(1)|浏览(155)

我正在开发一个使用Xamarin表单的Android和iOS应用程序。目前,当应用程序启动时,在我的闪屏前显示一个白色屏幕。我们如何删除白色屏幕,直接显示闪屏?
App.xaml.cs

MainPage = new NavigationPage(new SplashScreen());

MainActivity.cs

{
    [Activity(Label = "testApp", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity, ActivityCompat.IOnRequestPermissionsResultCallback
    {
 protected override void OnCreate(Bundle savedInstanceState)
        {
            base.SetTheme(Resource.Style.MainTheme);

            base.OnCreate(savedInstanceState);
}
}
xpszyzbs

xpszyzbs1#

Android 12不允许额外的Activity作为闪屏,因此上面的链接已经过时了。下面链接中的解决方案将为任何Xamarin. Android应用启用闪屏。https://github.com/gmck/XamarinBasicSplashScreen
下面是官方android docs https://developer.android.com/develop/ui/views/launch/splash-screen的链接

相关问题