0

I tried to make a splash screen for my app as described here: How do I make a splash screen? This works pretty fine if I use a single image/drawable resource.

But if I create a layout (even with only one image!) as splash screen it won't work; it'll only take longer the app to start and when it opens, it shows the normal layout directly.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Dawg85
  • 61
  • 1
  • 5

2 Answers2

2

Since you haven't pasted any code, I don't know if you want help with your code or a suggestion regarding Splash Screens. However, this is the best guide I've seen of how to use Splash screens.

Basically, you create a drawablewith the desired splash screen image.

    <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:drawable="@color/white"/>

    <item>
        <bitmap
            android:gravity="center"
            android:src="@drawable/peem_logo"/>
    </item>

</layer-list>

Next, create a style for your splash activity:

<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
    <item name="android:windowBackground">@drawable/splash_drawable</item>
</style>

Make your Activity as Launcher and then in it:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = new Intent(this, MainActivity.class);
    startActivity(intent);
    finish();
}

That's all you need.

jlively
  • 735
  • 2
  • 9
  • 29
-1

Try this libraries AwesomeSplash, it provides you many different animation.

compile 'com.github.ViksaaSkool:AwesomeSplash:v1.0.0'

Yessine Mahdouani
  • 1,225
  • 12
  • 24