android - (Android) 在 Xamarin Forms 3.3 上更改模块时总是显示启动画面?
问题描述
Xamarin Forms
使用3.3 版时遇到问题。在Android上,当切换模块(示例模块Home
)时,Splash Screen
总是显示(我在Android上的每个屏幕之间遇到这个问题)。(在 iOS 上,完美运行)
在Xamarin Forms
2.5 版本上,它没有这个问题。
Splash Screen
在 Xamarin Forms 3.3 上切换模块时如何防止显示。
我试过了,但它不起作用。 ANDROID:SPLASH:为什么我在应用程序恢复时总是看到启动画面
这是我的代码:
<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)]
谢谢!
解决方案
您在 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));
}
}
推荐阅读
- junit5 - 第一次崩溃后如何使用参数“-Dsurefire.skipAfterFailureCount=1”跳过测试
- java - 我们可以在同一方法中使用多个同步块吗
- css - 如何在另一个 div 上设置显示 div 的样式
- reactjs - 我刚刚使用了反应上下文,如果我在其他组件上进行控制台,为什么静态上下文不起作用
- android - org.json.JSONException:overview_polyLine 没有值
- javascript - 动态检测文本框值是否更改
- python - 使用 pip 在 Python 3.8.0 中安装 numpy 时如何修复“错误:命令错误退出状态为 1”
- amazon-web-services - 如何配置 AWS lambda 函数以对不同 aws 子账户中的 dynamodb 表执行 crud 操作?
- python - Is numpy.array() equivalent to numpy.stack(..., axis=0)?
- javascript - 当我尝试将数据变量用作颜色对象属性时,它会记录为未定义。数据=“蓝色”。我希望它以 colors.blue 的形式返回