本文將介紹如何爲混合應用加入歡迎界面,本教程將在教程一的代碼上進行修改。 html
爲混合應用加入歡迎界面可使用Cordova SplashScreen插件。 android
一,增長不一樣尺寸的歡迎界面圖片資源 git
二,在config.xml增長SplashScreen插件配置 express
1,SplashScreen屬性value值對應圖片名稱 apache
<preference name="splashscreen" value="splash" />
2,SplashScreenDelay屬性value值表示歡迎界面關閉時間 app
<preference name="SplashScreenDelay" value="5000" />3,完整配置:
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <widget xmlns = "http://www.w3.org/ns/widgets" id = "io.cordova.helloCordova" version = "2.0.0"> <name>Hello Cordova</name> <description> A sample Apache Cordova application that responds to the deviceready event. </description> <author href="http://cordova.io" email="dev@cordova.apache.org"> Apache Cordova Team </author> <access origin="*"/> <!-- <content src="http://mysite.com/myapp.html" /> for external pages --> <content src="index.html" /> <preference name="loglevel" value="DEBUG" /> <preference name="splashscreen" value="splash" /> <preference name="SplashScreenDelay" value="5000" /> <preference name="backgroundColor" value="0xFFF" /> <!--<preference name="loadUrlTimeoutValue" value="5000" /> <preference name="InAppBrowserStorageEnabled" value="true" /> <preference name="disallowOverscroll" value="true" />--> <!-- This is required for native Android hooks --> <feature name="App"> <param name="android-package" value="org.apache.cordova.App" /> </feature> <feature name="SplashScreen"> <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" /> </feature> </widget>
三,運行效果 less
四,源碼及安裝包地址:https://git.oschina.net/czpae86/Hybrid-Apps.git ui