0

Most of google applications (e.g Google Maps, Google sheets, etc...) have a pretty nice splashscreen, that pops up very quickly.

enter image description here

It doesn't look like a "classic" Android splashscreen made of an Activity launching another one after xx secs.

It makes me think of the iOS equivalent (Launch images).

Is it a new UI element that we can use ? Does somebody have an hint about that ?

nios
  • 1,153
  • 1
  • 9
  • 20

1 Answers1

4

You have to use a theme for your SplashActivity instead of directly setting the image in the layout.For eg:

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

Then apply this theme to your splash activity in Manifest.for eg:

<activity
            android:name=".controller.activities.SplashActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.Splash"
             >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
Anirudh Sharma
  • 7,968
  • 13
  • 40
  • 42
  • Thank you, I'll give it a try ! – nios Jul 16 '15 at 12:36
  • @nios welcome .Do give it a try .that's the way i do it. – Anirudh Sharma Jul 16 '15 at 12:37
  • after adding this style in Main Activity. got this error "This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead" – Abu Nayem May 13 '20 at 21:32
  • @AbuNayemhave you tried this - https://stackoverflow.com/a/26515159/3852907 – Anirudh Sharma May 14 '20 at 07:40
  • When we migrate to the android navigation component, the application will have a single activity and splash fragment. Then how can we apply this style to splash fragment? – Hardik Bambhania Jul 30 '20 at 14:14