Skip to content

Instantly share code, notes, and snippets.

@irmanfrdev
Created December 17, 2019 04:02
Show Gist options
  • Save irmanfrdev/74d44c95fc090d4c22ba48f6142927c2 to your computer and use it in GitHub Desktop.
Save irmanfrdev/74d44c95fc090d4c22ba48f6142927c2 to your computer and use it in GitHub Desktop.
Android Splash Screen
...
<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>
...
res/drawable
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white"/>
<item>
<bitmap
android:src="@drawable/logo"
android:gravity="center" />
</item>
</layer-list>
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startActivity(new Intent(SplashActivity.this, MainActivity.class));
finish();
}
}
res/values/styles.xml
...
<!--Splash screen theme-->
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash_background</item>
</style>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment