【问题标题】:(Android) Always display Splash Screen when change module on Xamarin Forms 3.3?(Android) 在 Xamarin Forms 3.3 上更改模块时总是显示启动画面?
【发布时间】:2019-06-02 05:10:17
【问题描述】:

我在使用Xamarin Forms 3.3 版时遇到问题。 在Android上,当切换模块(示例模块Home)时,Splash Screen总是显示(我在Android上的每个屏幕之间遇到这个问题)。 (在 iOS 上完美运行)

Xamarin Forms 2.5版本上,没有这个问题。

在 Xamarin Forms 3.3 上切换模块时如何防止显示 Splash Screen

我试过了,但它不起作用。 ANDROID: SPLASH: Why I always see splash screen when app is resumed

这是我的代码:

<style name="MyProject" parent="MyProject.Base">
   <item name="android:windowBackground">@drawable/splash_screen</item>
   <item name="android:windowFullscreen">true</item>
   <item name="android:buttonStyle">@style/noPaddingButtonStyle</item>
   <item name="android:editTextStyle">@style/noPaddingEditTextStyle</item>
 </style>

并在MainActivity.cs使用它:

[Activity(Label = "MyProject",
    Theme = "@style/MyProject",
    Icon = "@drawable/ic_launcher",
    LaunchMode = LaunchMode.SingleInstance,
    Name = "com.myproject.mobile.MainActivity",
    MainLauncher = true,
    ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation,
    WindowSoftInputMode = SoftInput.AdjustPan)]

谢谢!

【问题讨论】:

  • 告诉我您的 MasterDetailPage 代码可能是然后我们将其定位到此
  • 我尝试将 X.F 3.3 升级到 X.F 3.4,它的工作完美且速度比 X.F3.3 更快。

标签: android xamarin xamarin.forms xamarin.android splash-screen


【解决方案1】:

您在 Android 上的每个屏幕之间都遇到过这个问题吗?还是仅当您在智能手机上切换应用程序(并返回您的应用程序)时?

如果问题是第二个:确保在您的启动画面活动声明之前有MainLauncher = true

例子:

[Activity(Theme = "@style/SplashTheme", MainLauncher = true, NoHistory = true, ScreenOrientation = ScreenOrientation.Portrait)]
public class SplashScreenActivity : Activity
{
    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);
        StartActivity(typeof(MainActivity));
    }
}

【讨论】:

  • 问题是第一个,我在Android上的每个屏幕之间都遇到了这个问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-01-14
  • 2020-06-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-07
相关资源
最近更新 更多