Thu, 04 Jun 2015 14:50:33 +0200
Genesis of lecture sources for Droidcon Berlin 2015 in Postbahnhof.
michael@0 | 1 | <!--- |
michael@0 | 2 | Licensed to the Apache Software Foundation (ASF) under one |
michael@0 | 3 | or more contributor license agreements. See the NOTICE file |
michael@0 | 4 | distributed with this work for additional information |
michael@0 | 5 | regarding copyright ownership. The ASF licenses this file |
michael@0 | 6 | to you under the Apache License, Version 2.0 (the |
michael@0 | 7 | "License"); you may not use this file except in compliance |
michael@0 | 8 | with the License. You may obtain a copy of the License at |
michael@0 | 9 | |
michael@0 | 10 | http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 11 | |
michael@0 | 12 | Unless required by applicable law or agreed to in writing, |
michael@0 | 13 | software distributed under the License is distributed on an |
michael@0 | 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
michael@0 | 15 | KIND, either express or implied. See the License for the |
michael@0 | 16 | specific language governing permissions and limitations |
michael@0 | 17 | under the License. |
michael@0 | 18 | --> |
michael@0 | 19 | |
michael@0 | 20 | # org.apache.cordova.splashscreen |
michael@0 | 21 | |
michael@0 | 22 | 這個外掛程式顯示和隱藏在應用程式啟動期間的初始螢幕。 |
michael@0 | 23 | |
michael@0 | 24 | ## 安裝 |
michael@0 | 25 | |
michael@0 | 26 | cordova plugin add org.apache.cordova.splashscreen |
michael@0 | 27 | |
michael@0 | 28 | |
michael@0 | 29 | ## 支援的平臺 |
michael@0 | 30 | |
michael@0 | 31 | * 亞馬遜火 OS |
michael@0 | 32 | * Android 系統 |
michael@0 | 33 | * 黑莓 10 |
michael@0 | 34 | * iOS |
michael@0 | 35 | * Windows Phone 7 和 8 |
michael@0 | 36 | * Windows 8 |
michael@0 | 37 | |
michael@0 | 38 | ## 方法 |
michael@0 | 39 | |
michael@0 | 40 | * splashscreen.show |
michael@0 | 41 | * splashscreen.hide |
michael@0 | 42 | |
michael@0 | 43 | ### Android 的怪癖 |
michael@0 | 44 | |
michael@0 | 45 | 在你的 config.xml,您需要添加以下優惠: |
michael@0 | 46 | |
michael@0 | 47 | `<preference name="SplashScreen" value="foo" />` `<preference name="SplashScreenDelay" value="10000" />` |
michael@0 | 48 | |
michael@0 | 49 | 美孚在哪裡閃屏檔,最好是 9 修補程式檔的名稱。 請確保您的 splashcreen 檔添加到 res/xml 目錄下相應的資料夾。 第二個參數表示多久閃屏會顯示以毫秒為單位。 它將預設為 3000 毫秒。 有關更多資訊,請參見[圖示和啟動畫面][1]。 |
michael@0 | 50 | |
michael@0 | 51 | [1]: http://cordova.apache.org/docs/en/edge/config_ref_images.md.html |
michael@0 | 52 | |
michael@0 | 53 | ## splashscreen.hide |
michael@0 | 54 | |
michael@0 | 55 | 解雇的閃屏。 |
michael@0 | 56 | |
michael@0 | 57 | navigator.splashscreen.hide() ; |
michael@0 | 58 | |
michael@0 | 59 | |
michael@0 | 60 | ### 黑莓 10,WP8,iOS 怪癖 |
michael@0 | 61 | |
michael@0 | 62 | `config.xml`檔的 `AutoHideSplashScreen` 設置必須為 `false` 。 若要延遲兩秒鐘隱藏的閃屏,添加如下所示在計時器 `deviceready` 事件處理常式: |
michael@0 | 63 | |
michael@0 | 64 | setTimeout(function() {navigator.splashscreen.hide() ;},2000年) ; |
michael@0 | 65 | |
michael@0 | 66 | |
michael@0 | 67 | ## splashscreen.show |
michael@0 | 68 | |
michael@0 | 69 | 顯示初始螢幕。 |
michael@0 | 70 | |
michael@0 | 71 | navigator.splashscreen.show() ; |
michael@0 | 72 | |
michael@0 | 73 | |
michael@0 | 74 | 您的應用程式無法調用 `navigator.splashscreen.show()` 直到應用程式已經開始, `deviceready` 觸發了事件。 但是,由於通常的閃屏為了是可見的在您的應用程式啟動之前,這似乎會打敗閃屏的目的。 提供一些配置在 `config.xml` 將自動 `show` 閃屏您的應用程式啟動後立即和之前它已經完全起步並收到 `deviceready` 事件。 做這種配置的詳細資訊,請參閱[圖示和啟動畫面][1]。 出於這個原因,它不太可能您需要調用 `navigator.splashscreen.show()` ,使初始螢幕可見為應用程式啟動。 |