michael@0: michael@0: michael@0: # org.apache.cordova.splashscreen michael@0: michael@0: 這個外掛程式顯示和隱藏在應用程式啟動期間的初始螢幕。 michael@0: michael@0: ## 安裝 michael@0: michael@0: cordova plugin add org.apache.cordova.splashscreen michael@0: michael@0: michael@0: ## 支援的平臺 michael@0: michael@0: * 亞馬遜火 OS michael@0: * Android 系統 michael@0: * 黑莓 10 michael@0: * iOS michael@0: * Windows Phone 7 和 8 michael@0: * Windows 8 michael@0: michael@0: ## 方法 michael@0: michael@0: * splashscreen.show michael@0: * splashscreen.hide michael@0: michael@0: ### Android 的怪癖 michael@0: michael@0: 在你的 config.xml,您需要添加以下優惠: michael@0: michael@0: `` `` michael@0: michael@0: 美孚在哪裡閃屏檔,最好是 9 修補程式檔的名稱。 請確保您的 splashcreen 檔添加到 res/xml 目錄下相應的資料夾。 第二個參數表示多久閃屏會顯示以毫秒為單位。 它將預設為 3000 毫秒。 有關更多資訊,請參見[圖示和啟動畫面][1]。 michael@0: michael@0: [1]: http://cordova.apache.org/docs/en/edge/config_ref_images.md.html michael@0: michael@0: ## splashscreen.hide michael@0: michael@0: 解雇的閃屏。 michael@0: michael@0: navigator.splashscreen.hide() ; michael@0: michael@0: michael@0: ### 黑莓 10,WP8,iOS 怪癖 michael@0: michael@0: `config.xml`檔的 `AutoHideSplashScreen` 設置必須為 `false` 。 若要延遲兩秒鐘隱藏的閃屏,添加如下所示在計時器 `deviceready` 事件處理常式: michael@0: michael@0: setTimeout(function() {navigator.splashscreen.hide() ;},2000年) ; michael@0: michael@0: michael@0: ## splashscreen.show michael@0: michael@0: 顯示初始螢幕。 michael@0: michael@0: navigator.splashscreen.show() ; michael@0: michael@0: michael@0: 您的應用程式無法調用 `navigator.splashscreen.show()` 直到應用程式已經開始, `deviceready` 觸發了事件。 但是,由於通常的閃屏為了是可見的在您的應用程式啟動之前,這似乎會打敗閃屏的目的。 提供一些配置在 `config.xml` 將自動 `show` 閃屏您的應用程式啟動後立即和之前它已經完全起步並收到 `deviceready` 事件。 做這種配置的詳細資訊,請參閱[圖示和啟動畫面][1]。 出於這個原因,它不太可能您需要調用 `navigator.splashscreen.show()` ,使初始螢幕可見為應用程式啟動。