Last active
February 24, 2021 19:36
-
-
Save saifkhichi96/653778bf0332b1bf6a888a171dbb190b to your computer and use it in GitHub Desktop.
Themed launch screen on Android
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
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
<activity android:name=".LauncherActivity" | |
android:theme="@style/AppTheme.Launcher"> | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN"/> | |
<category android:name="android.intent.category.LAUNCHER"/> | |
</intent-filter> | |
</activity> |
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
class LauncherActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
setTheme(R.style.AppTheme) | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
// ... | |
} | |
} |
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
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque"> | |
<!-- a solid background color --> | |
<item android:drawable="@color/colorPrimary"/> | |
<!-- with a 144dp wide app logo centered on top of the background --> | |
<item> | |
<bitmap android:src="@drawable/product_logo_144dp" | |
android:gravity="center"/> | |
</item> | |
</layer-list> |
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
<resources> | |
<!-- normal AppTheme here --> | |
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |
<!-- customize your theme here --> | |
</style> | |
<!-- LauncherActivity theme --> | |
<style name="AppTheme.Launcher" parent="AppTheme"> | |
<item name="android:windowBackground">@drawable/splash</item> | |
</style> | |
</resources> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment