2016-11-17 448 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中心的圖標周圍進行動畫處理。