When I click the app icons and start to run the apps, it will appear a white screen for 1 sec.
I don't know why.
Is there any idea to clear this white screen and directly go to my activity?

- 3,281
- 8
- 32
- 55
-
can you post the onCreate() of the activity that is launched when you start the app? – James McCracken Sep 27 '12 at 03:05
-
Do you perform any tasks, like initializing something or downloading something at the first start? – Siddharth Lele Sep 27 '12 at 03:31
-
yes, but I have set a progressdialog, but it still show the white screen for 1sec, then progressdialog – jjLin Sep 27 '12 at 04:29
-
Post your `onCreate()` for the first activity. – Siddharth Lele Sep 27 '12 at 04:41
7 Answers
The white/black screen is the window background image.
The window background is shown while e.g. your onCreate()
runs and your layouts are being inflated. It can take some time especially if there's a lot of bitmaps that need to be read, decoded and scaled.
Changing the theme works because some themes have a non-default window background. For example, Theme.Wallpaper
has a transparent background. There are other definitions there, too. Essentially what you want is:
<style name="YourTheme">
<item name="android:windowBackground">@null</item>
</style>
Programmatically you can achieve the same with
getWindow().setBackgroundDrawable(null);
at the top of activity onCreate()
.
(Old question but got bumped up by another answer and there wasn't a good answer.)

- 150,114
- 66
- 286
- 303
Settings. File>Settings>Build,Deployment>Instant Run Deselect all options shown there.
and add below line in your style.xml
<item name="android:windowDisablePreview">true</item>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- 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:windowFullscreen">true</item>
<item name="android:windowDisablePreview">true</item>
</style>
apply changes in AndroidMainfest.xml
<application
android:theme="@style/AppTheme">

- 156
- 5
After I change style.xml:
<resources>
<style name="AppTheme" parent="android:Theme.Wallpaper" />
</resources>
it works!! Thanks all

- 3,281
- 8
- 32
- 55
-
1Answer is unclear since your question does not have a context of your discussion. – taxeeta Aug 09 '13 at 15:15
Add the following in the manifest file of the corresponding activity
android:launchMode="standard"
and remove android:label="@string/app_name" from the corresponding activity ,this actually helped me

- 546
- 5
- 5
In your manifest.xml
file remove the line android:theme="@style/AppTheme"
for your app. and check it again

- 20,897
- 15
- 57
- 78
In Styles add the following things
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item>
Hope this will help you and its working for me

- 177
- 1
- 2
- 10