简体   繁体   English

在启动屏幕和视频无法在全屏上播放时自定义黑屏

[英]Customizing the blank screen before splash screen and videos not playing in full screen on phonegap

I am building an app on phonegap that displays several links. 我正在phonegap上构建一个显示几个链接的应用程序。 A blank screen with the icon and title on the left top appears before the splash screen appears when I open the app. 当我打开应用程序时,在初始屏幕出现之前,将出现一个带有左上角图标和标题的空白屏幕。 However I found online that it is normal in android but we can customize it. 但是我在线发现它在android中很正常,但是我们可以自定义它。 Is there any way I can customize it in phonegap and if so how? 有什么方法可以在phonegap中自定义它?

When a user presses a link, it opens the link in an inappbrowser. 当用户按下链接时,它将在一个非浏览器中打开该链接。 Everything works accordingly on ios. 一切都可以在ios上正常运行。 However when it comes to android, if there are any videos in those links, they do not play on fullscreen but they do on ios. 但是,当涉及到android时,如果这些链接中有任何视频,则它们不会在全屏模式下播放,而会在ios上播放。 When I press the enlarge button, nothing happens. 当我按下放大按钮时,什么也没有发生。 The video just keeps playing without enlarging on the android. 视频只是一直播放而没有在android上放大。

Below is my config.xml for android if it helps. 下面是我的android的config.xml(如果有帮助的话)。

<preference name="orientation" value="portrait" />
    <preference name="fullscreen" value="true" />
    <preference name="target-device" value="universal" />

    <preference name="prerendered-icon" value="true" />
    <preference name="stay-in-webview" value="false" />

    <preference name="detect-data-types" value="true" />
    <preference name="exit-on-suspend" value="false" />
    <preference name="show-splash-screen-spinner" value="false" />
    <preference name="auto-hide-splash-screen" value="true" />
    <preference name="EnableViewportScale" value="true" />
    <preference name="MediaPlaybackRequiresUserAction" value="true" />
    <preference name="AllowInlineMediaPlayback" value="true" />
    <preference name="BackupWebStorage" value="local" />
    <preference name="TopActivityIndicator" value="gray" />
    <preference name="HideKeyboardFormAccessoryBar" value="false" />
    <preference name="android-minSdkVersion" value="15" />
    <preference name="android-targetSdkVersion" value="22" /> 

    <preference name="android-installLocation" value="auto" />
    <preference name="SplashScreenDelay" value="5000" /> 
    <preference name="ErrorUrl" value=""/>
    <preference name="BackgroundColor" value="0x000000"/>
    <preference name="KeepRunning" value="true"/>
    <preference name="DisallowOverscroll" value="true"/>
    <preference name="LoadingDialog" value=","/> 
    <preference name="LoadUrlTimeoutValue" value="20000" />
    <preference name="disable-cursor" value="false" />

    <gap:platform name="android" />

    <feature name="http://api.phonegap.com/1.0/battery"/>
    <feature name="http://api.phonegap.com/1.0/geolocation"/>
    <feature name="http://api.phonegap.com/1.0/network"/>
    <feature name="http://api.phonegap.com/1.0/notification"/>
    <feature name="http://api.phonegap.com/1.0/geolocation"/>
    <feature name="http://api.phonegap.com/1.0/network"/>
    <gap:plugin name="org.apache.cordova.battery-status"  />
    <gap:plugin name="org.apache.cordova.device-motion"  />
    <gap:plugin name="org.apache.cordova.dialogs"  />
    <gap:plugin name="org.apache.cordova.geolocation"  />

    <gap:plugin name="org.apache.cordova.dialogs" />
    <gap:plugin name="org.apache.cordova.inappbrowser" />
    <gap:plugin name="org.apache.cordova.media"  />
    <gap:plugin name="org.apache.cordova.network-information"  />
    <gap:plugin name="org.apache.cordova.splashscreen"  />
    <gap:plugin name="org.apache.cordova.vibration"  />


    <icon src="res/icon/android/icon-36-ldpi.png" gap:platform="android" gap:density="ldpi" />
    <icon src="res/icon/android/icon-48-mdpi.png" gap:platform="android" gap:density="mdpi" />
    <icon src="res/icon/android/icon-72-hdpi.png" gap:platform="android" gap:density="hdpi" />
    <icon src="res/icon/android/icon-96-xhdpi.png" gap:platform="android" gap:density="xhdpi" />
    <icon src="res/icon/android/icon-xxhdpi.png" gap:platform="android" gap:density="xxhdpi" />
    <icon src="res/icon/android/icon-xxxhdpi.png" gap:platform="android" gap:density="xxxhdpi" />

    <icon src="icon.png" />

    <gap:splash src="res/screen/android/screen-ldpi-potrait.png" gap:platform="android" gap:density="ldpi" />
    <gap:splash src="res/screen/android/screen-mdpi-potrait.png" gap:platform="android" gap:density="mdpi" />
    <gap:splash src="res/screen/android/screen-hdpi-potrait.png" gap:platform="android" gap:density="hdpi" />
    <gap:splash src="res/screen/android/screen-xhdpi-potrait.png" gap:platform="android" gap:density="xhdpi" />
    <gap:splash src="res/screen/windows-phone/screen-portrait.png" gap:platform="winphone" />
    <access origin="*"/>

I have been trying to see where the problem is for the last two weeks but in vain. 我一直在尝试查看问题在过去两个星期在哪里,但徒劳无功。 Any help is truly appreciated. 任何帮助,我们都感激不尽。

You could try this for the "blank screen that appears before the splash" 您可以尝试使用“启动时出现的空白屏幕”

In the "platforms\\android" folder under your project, open the AndroidManifest.xml and search for android:theme inside the <activity> tag that contains android:name="MainActivity" and change the default value (that is android:theme="@android:style/Theme.DeviceDefault.NoActionBar" ) to android:theme="@android:style/Theme.Translucent" . 在项目下的“ platforms \\ android”文件夹中,打开AndroidManifest.xml并在包含android:name="MainActivity"<activity>标记内搜索android:theme并更改默认值(即android:theme="@android:style/Theme.DeviceDefault.NoActionBar" )到android:theme="@android:style/Theme.Translucent" Save the file and build your project again, the grey screen should desapear. 保存文件并再次构建项目,灰屏消失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM