2016-11-17 109 views
0

每次在我的android应用程序启动有一个白色的窗口几秒钟。我在我的应用程序中有一个启动画面,我想要显示而不是此白色屏幕。我已经将windowDisablePreview设置为true,但它不起作用。如何解决这个问题。
真正无法隐藏android启动与android的白色窗口:windowDisablePreview

Android清单

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.ankitsrivastava.recyclerview"> 
    <uses-permission android:name="android.permission.INTERNET"/> 
    <application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 
    <!--Splash Screen--> 
    <activity 
     android:name=".app.SplashScreen" 
     android:theme="@style/AppTheme"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
    <!--Main Activity--> 
    <activity android:name=".app.MainActivity"> 
    </activity> 
</application> 

Styles.xml

<resources> 
<!-- Base application theme. --> 
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
    <item name="android:windowDisablePreview">true</item> 
</style> 

+0

检查你是否正在加载一个大的图像作为背景飞溅或你正在做onCreate/onResume飞溅一些重任务。将其放入PostDelayed或稍后加载。 – Naeem

回答

0

您应该遵循在​​关于如何创建一个启动画面右边的说明办法。在这里复制有点长,但基本上你将你的splash活动主题android:windowBackground的值设置为一个静态XML drawable。
您甚至可以更进一步,并在加载后使用绘图工具创建动画。一个简单的建议是,在飞溅布局中有一个圆形的进度条,它将在加载活动(并且应用程序大概仍然在加载数据)之后在Background Drawable中心的图标周围进行动画处理。