日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

cordova splashscreen插件在android平台的使用

發(fā)布時間:2025/3/15 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 cordova splashscreen插件在android平台的使用 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

先到插件網(wǎng)站找這個插件

插件網(wǎng)站地址?http://cordova.apache.org/plugins/

然后找到了這個

cordova-plugin-splashscreen?

插件 ?地址是https://www.npmjs.com/package/cordova-plugin-splashscreen

通過命令行安裝插件cordova plugin add cordova-plugin-splashscreen

安裝完之后你發(fā)現(xiàn)項目多了點(diǎn)東西比如

仔細(xì)觀察下項目的目錄結(jié)構(gòu),你會發(fā)現(xiàn)

screen.png對應(yīng)的就是歡迎頁面。

你可以將自己的screen.png覆蓋掉所有的,當(dāng)然大小最好按照原來的各個尺寸。。

用eclipse運(yùn)行一下。結(jié)果就ok了。


再說下插件的幾個屬性

Preferences

config.xml

  • SplashScreen?(string). The resource name which is used for the displaying splash screen. Different platforms use values for this.

    ?<preference?name="SplashScreen"?value="resourcename"?/>
  • AutoHideSplashScreen?(boolean, default to?true). Indicates wherether hide splash screen automatically or not. Splash screen hidden after amount of time specified in the?SplashScreenDelay?preference.

    ?<preference?name="AutoHideSplashScreen"?value="true"?/>
  • SplashScreenDelay?(number, default to 3000). Amount of time in milliseconds to wait before automatically hide splash screen.

    ?<preference?name="SplashScreenDelay"?value="3000"?/>

?


在config.xml中可以配置

<preference?name="SplashScreen"?value="resourcename"?/>

?resourcename指定的是資源的文件名。假如我們這里不設(shè)置。

默認(rèn)就是

<preference?name="SplashScreen"?value="screen"?/>為了做個測試,我在各個文件夾下添加了screen1.png 然后在config.xml中指定 <preference?name="SplashScreen"?value="screen1"?/>再運(yùn)行一下發(fā)現(xiàn)歡迎頁面變成了screen1.png圖片


<preference?name="SplashScreenDelay"?value="3000"?/>

對應(yīng)這個設(shè)置,如果我們首次進(jìn)入首頁會比較慢,比如首頁指定的是非本地的html,指定的是一個網(wǎng)絡(luò)地址的文件,我們可以考慮將value設(shè)置為100000 ?也即是10秒。然后再在

設(shè)備準(zhǔn)備好之后

執(zhí)行navigator.splashscreen.hide(); 例子如下

var?app?=?{//?Application?Constructorinitialize:?function()?{this.bindEvents();},//?Bind?Event?Listeners////?Bind?any?events?that?are?required?on?startup.?Common?events?are://?'load',?'deviceready',?'offline',?and?'online'.bindEvents:?function()?{document.addEventListener('deviceready',?this.onDeviceReady,?false);},//?deviceready?Event?Handler////?The?scope?of?'this'?is?the?event.?In?order?to?call?the?'receivedEvent'//?function,?we?must?explicitly?call?'app.receivedEvent(...);'onDeviceReady:?function()?{//app.receivedEvent('deviceready');navigator.splashscreen.hide();},




轉(zhuǎn)載于:https://my.oschina.net/liangzhenghui/blog/546845

總結(jié)

以上是生活随笔為你收集整理的cordova splashscreen插件在android平台的使用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。