I found another way to do a splash screen with Delphi XE5 Firemonkey apps on Android over at a Korean Delphi blog by Humphrey. Kim Hyun – Soo. Basically this method is much easier than modifying the classes.dex file and much better than just implementing the splash screen on your Delphi form. The idea of the splash screen is to have something for the user to look at instead of a black screen while the rest of the app is loading. The general implementation is that you create a styles.xml file which sets up a background image as a style and then you assign that to the theme part of the Android manifest. You must include the styles.xml file and the splash screen image in your project when deploying, make the small change to the Android manifest, and that is all there is to it. The change to the Android manifest looks like this:
android: theme = "@ style / MyTheme.NoTitleBar.SplashWindow">
And the contents of the styles.xml file looks like this:
<resources>
<style name="MyTheme.NoTitleBar.SplashWindow" parent="@android:Theme.Holo">
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
</resources>
The original blog post is in Korean so I’ve passed it through Google Translate. The Korean blog post also references this Chinese blog post which may be where the original idea is from.
Head over and read the full blog post about the splash screen.
You can also click through directly to a sample app with source code on Github.
Update: Also take a look at some more sample source code here and another blog post here.
Got it working BUT not with the font tag in the style.xml
This method is here working fine too, thanks to the available source code example. But this is technic has some drawback(s) and One of them it is stretching and squeezing the Image to fit the scrreen, circles become eegs, nothing what can be appreciated – let say for a real company logo.
So i did some digging and we are sadly not alone with this approch, but i found only a particul solution for my problem, which is “The image sould keeping its aspect ratio, while fitting the screen”.
The particular solution it found is answer here http://stackoverflow.com/questions/12607756/show-splash-screen-image-with-auto-fit
The resulting effect can be seen in the image of this question http://stackoverflow.com/questions/10679366/android-background-image-to-fill-screen
So on the small scrren, you will only see the center of the image. Maybe someone has found a even better solution, please post it here or somewhere else, but i hope(a lie) Embarcadero will come up with a real answer – say it wih a more RAD approach.
I “played” a little bit further with this topic and ask myself how is it possible to support multiple screen size, resolution, oriantion, density, format 4:3, 16:9, etc. pp. – using only xml config files. After some google digging i found out how the Android OS support such functionality. You simply must provide copies of the same image(filename) with alternative resolutions and put these files each into specified paths, depending on the App supported Android API Level, which is described fully here http://developer.android.com/guide/practices/screens_support.html .
I did same basic tests and i was able to show different Splash Screen images depending on the actual screen size of two tablets 7 and 10 inches. I noted if the provied image is smaller as the physical screen of the device the “empty parts” are drawn black. A solution for this problem might be an NinePatch http://developer.android.com/tools/help/draw9patch.html .
Got this working, but it does not seem to solve the black screen problem. It now shows the splash immedaitely, then the black screen
shows afterwards and the user still has to wait with a black screen till the app starts. I have a datasnap app which
is slow to start. Maybe I have missed something.
What happens if you add the splash screen to an empty app? Do you still get the black screen between the splash and the app becoming visible? If no, then my recommendation is to move your setup out of OnCreate and OnShow if possible (like with a 1-3 second timer). And do some kind of lazy form creation: http://blogs.embarcadero.com/pawelglowacki/2014/02/19/40191/
A problem with this approach: Forms without Titlebar.