[英]Cordova - How to not have a splash screen?
我不想為我的Cordova項目(Android和iOS)啟動閃屏,如何刪除它? 我試圖禁用啟動畫面插件,但它會繼續出現! 怎么解決?
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" id="app.appname" version="1.0.0">
<name>App name</name>
<description>
App name description
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html"/>
<plugin name="cordova-plugin-whitelist" spec="1"/>
<access origin="*"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<allow-intent href="tel:*"/>
<allow-intent href="sms:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="geo:*"/>
<platform name="android">
<allow-intent href="market:*"/>
</platform>
<platform name="ios">
<allow-intent href="itms:*"/>
<allow-intent href="itms-apps:*"/>
</platform>
<preference name="SplashScreen" value="none"/>
</widget>
當您在項目中使用cordova時,可以通過將此標記添加到config.xml來輕松刪除啟動屏幕
<preference name="SplashScreen" value="none"/>
PLS。 在config.xml中更改如下:
<preference name="AutoHideSplashScreen" value="true" />
<preference name="SplashScreenDelay" value="0"/>
啊,終於來了! 我在同樣的問題上掙扎。 似乎 - 至少對於IOS構建 - 無論我嘗試什么,都必須使用閃屏。
我發現我可以為每個支持/推薦的大小添加png文件,然后啟動會使用那個。 我選擇了一張合適的照片,但如果你願意,你可以創建一個空白(白色或黑色)png。
Phonegap或IOS挑選所有各種尺寸,所以提供所有!
<platform name="ios">
<icon platform="ios" src="www/res/icon/ios/icon.png" height="57" width="57" />
<icon platform="ios" src="www/res/icon/ios/icon@2x.png" height="114" width="114" />
<icon platform="ios" src="www/res/icon/ios/icon-40.png" height="40" width="40" />
<icon platform="ios" src="www/res/icon/ios/icon-40@2x.png" height="80" width="80" />
<icon platform="ios" src="www/res/icon/ios/icon-50.png" height="50" width="50" />
<icon platform="ios" src="www/res/icon/ios/icon-50@2x.png" height="100" width="100" />
<icon platform="ios" src="www/res/icon/ios/icon-60.png" height="60" width="60" />
<icon platform="ios" src="www/res/icon/ios/icon-60@2x.png" height="120" width="120" />
<icon platform="ios" src="www/res/icon/ios/icon-60@3x.png" height="180" width="180" />
<icon platform="ios" src="www/res/icon/ios/icon-72.png" height="72" width="72" />
<icon platform="ios" src="www/res/icon/ios/icon-72@2x.png" height="144" width="144" />
<icon platform="ios" src="www/res/icon/ios/icon-76.png" height="76" width="76" />
<icon platform="ios" src="www/res/icon/ios/icon-76@2x.png" height="152" width="152" />
<icon platform="ios" src="www/res/icon/ios/icon-small.png" height="29" width="29" />
<icon platform="ios" src="www/res/icon/ios/icon-small@2x.png" height="58" width="58" />
<icon platform="ios" src="www/res/icon/ios/icon-small@3x.png" height="87" width="87" />
<splash src="splash.png" width="320" height="480" />
<!-- iPhone and iPod touch -->
<splash src="www/res/splash/ios/default.png" platform="ios" width="320" height="480" />
<splash src="www/res/splash/ios/default@2x.png" platform="ios" width="640" height="960" />
<!-- iPhone 5 / iPod Touch (5th Generation) -->
<splash src="www/res/splash/ios/default-568h@2x.png" platform="ios" width="640" height="1136" />
<!-- iPhone 6 -->
<splash src="www/res/splash/ios/default-667h@2x.png" platform="ios" width="750" height="1334" />
<splash src="www/res/splash/ios/default-portrait-736h@3x.png" platform="ios" width="1242" height="2208" />
<!--<splash src="www/res/splash/ios/default-landscape-736h@3x.png" platform="ios" width="2208" height="1242" />-->
<!-- iPad -->
<splash src="www/res/splash/ios/default-portrait.png" platform="ios" width="768" height="1024" />
<!--<splash src="www/res/splash/ios/default-landscape.png" platform="ios" width="1024" height="768" />-->
<!-- Retina iPad -->
<splash src="www/res/splash/ios/default-portrait@2x.png" platform="ios" width="1536" height="2048" />
<!--<splash src="www/res/splash/ios/default-landscape@2x.png" platform="ios" width="2048" height="1536" />-->
</platform>
如果選項:
<preference name="SplashScreen" value="none"/>
不起作用。
你可以把這個函數放在DeviceReady上:
function onDeviceReady() {
navigator.splashscreen.hide();
}
在您的config.xml中必須是splashscreen插件
<gap:plugin name="org.apache.cordova.splashscreen" />
如果此選項不起作用,您可以將splashscreen圖像默認設置為空白並放入config.xml
<gap:splash src="splash.png" /
將splash.png圖像放在項目的根目錄下。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.