安卓黑屏之前的飞溅屏幕在Kitkat版本



在我的Android应用程序中,我在启动屏幕之前看到了黑屏,所以我

have customized app theme as follows:
    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- my custom theme. -->
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowBackground">@drawable/splash1</item>
    </style>

以下是API版本20及以下版本的工作,但在kitkat版本(API版本21)中,它打开了我的启动屏幕两次。工作了很长时间,我找不到解决办法。请帮我一下。

我的屏幕是空白的,我发现"任务描述的原色应该是不透明的"的问题,这意味着你必须将colorPrimary和colorPrimaryDark替换为6位数字,

例如:如果你取colorPrimary=#4D607D8B,去掉"4D",最后是#607D8B。您可以参考此链接:https://stackoverflow.com/a/29166908/2897365

试试这个,

在清单文件中的应用程序标记中添加与您正在使用的背景相同的主题,以防止绘制黑屏。

theme.xml

<resources>
<!-- Base application theme is the default theme. -->
<style name="Theme" parent="android:style/Theme" />
<style name="Theme.MyAppTheme" parent="Theme">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowBackground">@drawable/my_app_background</item>
</style>
</resources>

AndroidManifest.xml

<application
        android:name="@string/app_name"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.MyAppTheme" >

最新更新