-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6afb44d
commit 10f6b64
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,38 @@ | ||
# simple-splash-screen | ||
An example project to show how to implement a simple splash screen | ||
|
||
You start by creating a new activity called SplashActivity and define it as the Launcher Activity, then you set the SplashTheme in the activity definition in AndroidManifest.xml | ||
|
||
``` | ||
<activity | ||
android:name=".SplashActivity" | ||
android:theme="@style/SplashTheme"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
``` | ||
|
||
In res -> values -> styles.xml you create a new style with SplashTheme name and define an item called android:windowBackground that will be a drawable that you will create in the next step. | ||
|
||
``` | ||
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar"> | ||
<item name="android:windowBackground">@drawable/background_splash</item> | ||
</style> | ||
``` | ||
|
||
In res -> drawable folder you will create a background_splash.xml with two layers, a white background and the launcher icon the in center. You can customize this xml file the way you want. | ||
|
||
``` | ||
<?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/ic_launcher"/> | ||
</item> | ||
</layer-list> | ||
``` |