Android splash screen logo gets pushed down
-
I've been using this guide to make a splashscreen for my app: https://medium.com/@benlaud/complete-guide-to-make-a-splash-screen-for-your-qml-android-application-567ca3bc70af however right after the Qt libraries are loaded and the Java activity actually starts (around
I/ActivityManager( 594): Displayed com.my.app/.MyActivity: +601ms
) the logo gets pushed down by a few pixels, I'm using<bitmap android:src="@drawable/splash_logo" android:gravity="center" />
to position the image.Following the guide closely didn't actually work and I had to make these modifications
QtActivity.java
- QT_ANDROID_THEMES = new String[] {"Theme_Holo_Light"}; - QT_ANDROID_DEFAULT_THEME = "Theme_Holo_Light"; + QT_ANDROID_THEMES = new String[] {"Theme_NoTitleBar"}; + QT_ANDROID_DEFAULT_THEME = "Theme_NoTitleBar"; } else { - QT_ANDROID_THEMES = new String[] {"Theme_DeviceDefault_Light"}; - QT_ANDROID_DEFAULT_THEME = "Theme_DeviceDefault_Light"; + QT_ANDROID_THEMES = new String[] {"Theme_NoTitleBar"}; + QT_ANDROID_DEFAULT_THEME = "Theme_NoTitleBar";
I also tried these but they didn't really change anything
QtActivityLoader.java// m_activity.requestWindowFeature(Window.FEATURE_ACTION_BAR);
//m_activity.setTheme(Class.forName("android.R$style").getDeclaredField(QT_ANDROID_DEFAULT_THEME).getInt(null)); m_activity.setTheme(Class.forName(com.my.app.R$style").getDeclaredField("MyAppTheme_NoTitleBar").getInt(null));
Anyone knows any workaround or fix for this?
edit.: I'm using Qt 5.9.1 and it appears on all Android versions
-
Looks like the way Qt creates the splash screen in QtActivityDelegate.java makes the splash screen pushed down, if I remove
android.app.splash_screen_drawable
from my AndroidManifest.xml (and addm_activity.setTheme(Class.forName(com.my.app.R$style").getDeclaredField("MyAppTheme_NoTitleBar").getInt(null));
) the splash screen does behave like expected.(unfortunately because of this I can't use this workaround for the flickering that happens between the transition between splash and qml https://bugreports.qt.io/browse/QTBUG-43558?focusedCommentId=344174&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-344174 but at it's something)
-
It's not caused by Qt. Qt displays the splashscreen correctly, respecting insets (like statusbar) but you are most probably using "android:windowBackground" in the theme and this just doesn't respect any insets. API 26+ has adressed that issue by introducing "android:windowSplashscreenContent".