Created
April 2, 2021 08:29
-
-
Save DaChelimo/26464c1f7dbe8e5776295253ecd517ac to your computer and use it in GitHub Desktop.
How to create splash screen
This file contains hidden or 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
<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> | |
<activity | |
android:name=".MainActivity" | |
android:configChanges="orientation" | |
android:label="@string/app_name" /> |
This file contains hidden or 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
class SplashActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setUpStatusBarAndNavigationBar() | |
} | |
override fun onStart() { | |
val intent = Intent(applicationContext, MainActivity::class.java) | |
startActivity(intent) | |
finish() | |
} | |
} |
This file contains hidden or 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
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar"> | |
<item name="android:statusBarColor" tools:targetApi="lollipop">@color/dark_theme_blue</item> | |
<item name="android:windowBackground">@drawable/splash_screen</item> | |
<item name="android:navigationBarColor" tools:targetApi="lollipop">@color/dark_theme_blue</item> | |
<item name="android:navigationBarDividerColor" tools:targetApi="o_mr1">@color/dark_theme_blue</item> | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment