Currently I have a very low-res splashscreen I made by setting the applications theme to a drawable image. This would work PERFECTLY if it wasn't for this. Now I'm looking for an alternative.
The one thing I will not do is create a timed splashscreen, which there are plenty of guidelines on how to make one, the one thing I want to know is how do I create a splashscreen that will load first thing, then finish once MainActivity
has finished loading?
The one thing I love about my current splashscreen is that it loads instantly when the app starts, but it will cause major delays when clicking buttons if it's high-res (more than 300x300pixels).
Here's my current code for the flawed, laggy splashscreen that loads and stops based on MainActivity
's loaded state:
in styles.xml
:
<style name="splashscreenTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:windowBackground">@drawable/splashscreen</item>
</style>
in manifest:
in AndroidManifest.xml
:
<application
android:allowBackup="true"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:fullBackupContent="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:theme="@style/splashscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>