Skip to content

Instantly share code, notes, and snippets.

@crazy1235
Created March 23, 2017 09:02
Show Gist options
  • Save crazy1235/958ce1761aa3cb6c9cfa1644a6520d00 to your computer and use it in GitHub Desktop.
Save crazy1235/958ce1761aa3cb6c9cfa1644a6520d00 to your computer and use it in GitHub Desktop.
SplashScreenDemo
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/colorPrimary" />
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher" />
</item>
</layer-list>
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Start home activity
startActivity(new Intent(SplashActivity.this, HomeActivity.class));
// close splash activity
finish();
}
}
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<!-- Splash Screen theme. -->
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash_background</item>
</style>
</resources>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment