Cordova fullscreen splash screen on Android still shows title bar

故事扮演 提交于 2019-12-04 13:55:27

问题


I am creating a fullscreen app using latest cordova. I have added the splash screen images and the plugin for it. And also in the config.xml, the preference to launch the app in fullscreen

<preference name="Fullscreen" value="true" />
<preference name="Orientation" value="landscape" />    
<preference name="SplashScreenDelay" value="1000" />

When running the app, the splash screen shows up, but the problem is that the app still shows the title bar on top, until the app finishes showing the splash screen, where the app finally goes into true full screen.

Is there a way/flag/mod to make the fullscreen work correctly while splash screen is displayed?


回答1:


The best way to show a full screen splash is by putting this line in your manifest under activity tag

android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"



回答2:


Del's answer definitely solves the problem, but it is problematic if you have the platforms directory ignored (it is derived content after all).

Fortunately, starting with cordova@6.4.0 you can use <edit-config> in config.xml too:

<?xml version='1.0' encoding='utf-8'?>
<widget ... xmlns:android="http://schemas.android.com/apk/res/android">
    ...
    <edit-config file="AndroidManifest.xml" mode="merge"
                 target="/manifest/application/activity">
        <activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
    </edit-config>
    ...
</widget>

This will ensure that AndroidManifest.xml will get updated whenever it is generated. Mind the additional XML Namespace for Android.



来源:https://stackoverflow.com/questions/34315998/cordova-fullscreen-splash-screen-on-android-still-shows-title-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!