即使这个职位是比较旧的,我实现闪屏,并可能通过更新样式解决这个时候也有过类似的经历/ SplashScreen的主题。 @frederico m rinaldi有时看到的屏幕通常是使用Android的默认(Holo)主题创建的。
虽然您没有提供适用于SplashScreen的样式(请参阅accepted answer的Theme = @style/Theme.Splash
),但这是我的。也许你可以检查它们是否有所不同。
<style name="Theme.Splash" parent ="Theme.AppCompat.Light.NoActionBar">
<!-- Use a fully opaque color as background. -->
<item name="android:windowBackground">@android:color/black</item>
<!-- This removes the title bar seen within the first screen. -->
<item name="windowNoTitle">true</item>
<!-- Let the splash screen use the entire screen space by enabling full screen mode -->
<item name="android:windowFullscreen">true</item>
<!-- Hide the ActionBar (Might be already defined within the parent theme) -->
<item name="windowActionBar">false</item>
</style>
您可能注意到,我只是用黑色作为背景,因为我的闪屏使用自定义布局文件,而不是静态图像(this.SetContentView(Resource.Layout.SplashScreen);
)。此外,加载图像(drawable
)可能需要一些时间,这可能是您可以看到默认主题而不是启动屏幕的主要原因。 此外,我省略了android:
XML名称空间的某些属性,这是由于Android支持库功能的Google's internal implementation。
请注意,为了使用程序兼容性的主题,你的应用程序必须包括AppCompat support library和你的活动必须继承Android.Support.V7.App.AppCompatActivity
。
您是否在splash主题中设置了正确的图像,并为该活动设置了主题,如教程中所示?它看起来像你的活动没有windowBackground图像。你有没有检查过其他版本的Android? – dylansturg
是的,我已经设置了一切像教程和19 20年它看起来不错,只有20出现在第一屏不到一秒钟,然后显示第二个与正确的布局。 –
[Xamarin Splash屏幕示例可能在手机横向模式下不起作用。如何解决它?](http://stackoverflow.com/questions/29991174/xamarin-splash-screen-example-does-not-work-in-landscape-mode-on-a-phone-how-to) – matthewrdev