Oh, sorry, at moment of writing answer I though about iOS splash screens.
As I know OpenFL doesnât support android splash screens out of the box, but it is pretty easy to add it, if you have basic knowledge about Android programming.
You have to override Android template - put <template path="templates" />
into project.xml
, than create folder templates
and put here what you want to override. If you use macOS or *NIX, you can find original templates in /usr/local/lib/haxe/lib/lime/<lime version>/templates
or /usr/lib/haxe/lib/lime/<lime version>/templates
.
If you want to create splash screen like .gif in your prev. post, you basically need following folder structure:
|- /templates
| |- /android
| |- /template
| |- /app
| |- /src
| |- /main
| |- /res
| | |- /drawable
| | | |- splash.xml <- we will create it later
| | |- /drawable-ldpi
| | | |- ic_splash.png <- we will create it later
| | |- /drawable-mdpi
| | | |- ic_splash.png <- we will create it later
| | |- /drawable-hdpi
| | | |- ic_splash.png <- we will create it later
| | |- /drawable-xhdpi
| | | |- ic_splash.png <- we will create it later
| | |- /drawable-xxhdpi
| | | |- ic_splash.png <- we will create it later
| | |- /drawable-xxxhdpi
| | | |- ic_splash.png <- we will create it later
| |- /values
| | |- colors.xml <- we will create it later
| | |- styles.xml <- we will create it later
| |- AndroidManifest.xml <- copy from lime
Step 1
Modify AndroidManifest.xml
- find android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
and change it to android:theme="@style/SplashTheme"
.
Step 2
Create styles.xml
:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="SplashTheme" parent="@android:style/Theme.NoTitleBar.Fullscreen">
<item name="android:windowBackground">@drawable/splash</item>
</style>
</resources>
Step 3
Create splash.xml
:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
<item android:drawable="@color/splash_bg" />
<item>
<bitmap android:gravity="center" android:src="@drawable/ic_splash" />
</item>
</layer-list>
Step 4
Create colors.xml
:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<color name="splash_bg">#cccccc</color> <!-- or put any color you want -->
</resources>
Step 5
Take an image you want to be in center of splash screen, resize it to several resolutions (ldpi, mdpi, hdpi, xxhdpi, etc) and put to appropriate folders. Probably you can use some online or offline tool to do resizing for you.
Finally
Thatâs all. Few notes:
- I didnât create additional
SplashActivity
here, because I think that for OpenFL it should work correctly even without it. But Iâm donât try it myself, so use it at your own risk
- Actually I didnât test it at all, so probably I can write something stupid here, but basically idea would be the same.