我正在开发一个使用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);
}
}
1条答案
按热度按时间xpszyzbs1#
Android 12不允许额外的Activity作为闪屏,因此上面的链接已经过时了。下面链接中的解决方案将为任何Xamarin. Android应用启用闪屏。https://github.com/gmck/XamarinBasicSplashScreen。
下面是官方android docs https://developer.android.com/develop/ui/views/launch/splash-screen的链接