简体   繁体   中英

UI freezes on removing white screen before splash

I am trying to remove white screen before splash so i followed solutions mentioned in these links

How To fix white screen on app Start up?

White screen before splashscreen

I tried almost every solution mentioned here

which includes changing activity theme to this

 android:theme="@android:style/Theme.Translucent.NoTitleBar"

or adding this to my theme

<item name="android:windowDisablePreview">true</item>

but implementing any of this freezes the UI for a while on click of the App icon after that everything works fine as desired.

Has anyone succeeded to fix this lag. Any help will be appreciated.

create a custom theme like,

 //splashTheme
 //create in styles
 <style name="splashTheme" parent="AppTheme">
    <!-- Customize your theme here. -->

    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>

</style>

and then apply the theme as follows,

 //manifest file
 <activity
        android:name=".SplashActivity"

        android:theme="@style/AppTheme.splashTheme"
        android:windowSoftInputMode="adjustResize|stateHidden" />

try this.

following changes work for me on mac:

1.Goto android studio preferences.
2.In Build,Execution and Deployment select "Instant run".
3.disable-Enable instant run to hot swap code/resource changes on deploy.
4.apply changes,clean project and rebuild again.

Finally got my answer Splash Screen in Right Way . I do just following.

In values-->styles.xml I created splash screen background image

<style name="Splash" parent="AppTheme.NoActionBar">
    <item name="android:windowBackground">@drawable/splash</item>
</style>

For below api 19, in values-19->styles.xml I used

<style name="Splash" parent="AppTheme.NoActionBar">
    <item name="android:windowBackground">@drawable/splash</item>
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">true</item>
</style>

I removed setContentview() from SplashActivity and added style for splash screen in Manifest.xml file android:theme="@style/Splash"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM