本文将介绍如何为混合应用加入欢迎界面,本教程将在教程一的代码上进行修改。 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