Custom Android themes and splash screens with Qt?



  • If I add a predefined theme without the action bar in AndroidManifest.xml the action bar is succesfuly not displayed :

    <activity android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" .../>
    

    However if I create my own simple theme in android/res/values/themes.xml :

    <resources>
        <color name="background">#ff0000</color>
        <style name="MyTheme" parent="@android:style/Theme.Holo.NoActionBar.Fullscreen">
            <item name="android:windowBackground">@color/background</item>
        </style>
    </resources>
    

    and set it in AndroidManifest.xml :

    <activity android:theme="@style/MyTheme" .../>
    

    In this case the application starts without the action bar and then instantly shows the action bar again with an annoying flickering.

    I need the theme to have a smooth transition between the launching of the app and the moment my application has control of the display. In my case, just a background color is enough and then I show my splash screen using QML.

    I tried setting

    meta-data android:name="android.app.splash_screen_drawable"
    

    but there is still a black screen displayed for a few frames between the moment the android splash image disappears and before the QML is loaded. The color black is actually the background color of the android theme. It would be white with a Light theme. This is why I'm trying to setup a custom theme which avoids the flickering problem but then I can not get the action bar to disappear...

    Am I doing something wrong or does Qt interfere with the theme upon launching ?





  • Thank you, that's a great post.

    However the initial problem I stated is still there :
    When I use a custom FULLSCREEN theme, the Qt app seems to override the setting.

    <resources>
        <color name="background">#ff0000</color>
    
        <style name="MyTheme" parent="@android:style/Theme.Holo">
            <item name="android:windowBackground">@color/background</item>
        </style>
    
        <style name="MyThemeFullscreen" parent="@android:style/Theme.Holo.NoActionBar.Fullscreen">
            <item name="android:windowBackground">@color/background</item>
        </style>
    </resources>
    
    android:theme="@style/MyTheme"           // works
    android:theme="@style/MyThemeFullscreen" // does not work
    



Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.