Displaying logo for few seconds at application start

Viewed 21604

I want to display a logo for few seconds before application starts and menu is visible. I want also to use some when it disappears. Should I create a new activity? Can I set it in layout ?

7 Answers

You can use splash logo at startup using styles-only method. Unfortunately it works only starting form API 23. But you don't need manage splash Activity.

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        ...
        <item name="android:windowBackground">@drawable/logo_startup</item>
        <item name="android:windowNoTitle">true</item>
    </style>

res/drawable-v23/logo_startup.xml:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

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

    <item android:width="@dimen/logo_startup" android:height="@dimen/logo_startup" android:gravity="center">
        <bitmap android:src="@drawable/logo"/> //use PNG file here, not vector
    </item>

</layer-list>

res/drawable/logo_startup.xml:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

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

</layer-list>
Related