2017-02-09 2 views
0

Ich habe das Begrüßungsbildschirm Plugin mit diesem: cordova Plugin cordova-Plugin-BegrüßungsbildschirmWie man Icon und Splashscreen in Ionic Creator hinzufügt?

Ich habe Bilder für das Symbol und Begrüßungsbildschirm hinzufügen, und fügte sie in den Ordner Ressourcen und haben diesen Code in meinem controller.js hinzugefügt:

.run(function($ionicPlatform) { 
    $ionicPlatform.ready(function() { 
     setTimeout(function() { 
      navigator.splashscreen.hide(); 
     }, 300); 
    }); 
}) 

Und ich fügte die folgenden in meinem config.xml:

<preference name="ShowSplashScreen" value="true" /> 
<preference name="SplashScreen" value="screen" /> 
<preference name="SplashScreenDelay" value="3000" /> 
<preference name="AutoHideSplashScreen" value="true" /> 
<preference name="SplashShowOnlyFirstTime" value="false" /> 
<preference name="FadeSplashScreen" value="false" /> 
<feature name="SplashScreen"> 
    <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" /> 
</feature> 

Und auch dieses:

Aber nach dem Erstellen meiner App (mit Adobes Online-PhoneGap Builder) wird das Symbol angezeigt, aber die App beginnt mit einem leeren weißen Bildschirm für ein paar Sekunden anstelle des Splashscreen. Was könnte das Problem sein?

Antwort

0

Fügen Sie das Plugin mit:

$ ionic plugin add org.apache.cordova.splashscreen 
$ ionic platform add android 
$ ionic build android 
$ ionic run android 

Sobald das Bild erstellt wird, müssen Sie es in Ihrem Projekt ua durch die folgenden config.xml durch Zusatz:

<splash src="pathtosplashimage" /> 

Beispielkonfiguration

Fügen Sie in der Datei config.xml auf der obersten Ebene (nicht in der Plattform) Konfigurationselemente wie die hier angegebenen hinzu.

Bitte beachten Sie, dass der Wert des Attributs "src" relativ zum Projektstammverzeichnis und nicht zum www-Verzeichnis ist (siehe Verzeichnisstruktur unten). Sie können das Quellbild beliebig benennen. Der interne Name in der App wird von Cordova festgelegt.

Verzeichnisstruktur:

projectRoot 
    hooks 
    platforms 
    plugins 
    www 
     css 
     img 
     js 
    res 
     screen 
      android 
      ios 
      windows 


<platform name="android"> 
    <!-- you can use any density that exists in the Android project --> 
    <splash src="res/screen/android/splash-land-hdpi.png" density="land-hdpi"/> 
    <splash src="res/screen/android/splash-land-ldpi.png" density="land-ldpi"/> 
    <splash src="res/screen/android/splash-land-mdpi.png" density="land-mdpi"/> 
    <splash src="res/screen/android/splash-land-xhdpi.png" density="land-xhdpi"/> 

    <splash src="res/screen/android/splash-port-hdpi.png" density="port-hdpi"/> 
    <splash src="res/screen/android/splash-port-ldpi.png" density="port-ldpi"/> 
    <splash src="res/screen/android/splash-port-mdpi.png" density="port-mdpi"/> 
    <splash src="res/screen/android/splash-port-xhdpi.png" density="port-xhdpi"/> 
</platform> 

<platform name="ios"> 
    <!-- There are two mechanisms for showing launch images. 
     -- Legacy method (supports all devices except iPad Pro 12.9): 
     -- Note: Images are determined by width and height. The following are supported --> 
    <splash src="res/screen/ios/Default~iphone.png" width="320" height="480"/> 
    <splash src="res/screen/ios/[email protected]~iphone.png" width="640" height="960"/> 
    <splash src="res/screen/ios/Default-Portrait~ipad.png" width="768" height="1024"/> 
    <splash src="res/screen/ios/[email protected]~ipad.png" width="1536" height="2048"/> 
    <splash src="res/screen/ios/Default-Landscape~ipad.png" width="1024" height="768"/> 
    <splash src="res/screen/ios/[email protected]~ipad.png" width="2048" height="1536"/> 
    <splash src="res/screen/ios/[email protected]~iphone.png" width="640" height="1136"/> 
    <splash src="res/screen/ios/Default-667h.png" width="750" height="1334"/> 
    <splash src="res/screen/ios/Default-736h.png" width="1242" height="2208"/> 
    <splash src="res/screen/ios/Default-Landscape-736h.png" width="2208" height="1242"/> 
    <!-- Storyboard method (supports all devices): 
     -- Important: If you use the storyboard method, legacy images are 
     -- copied but ignored. 
     -- Note: images are determined by scale, idiom, and size traits. The following 
     -- are suggested based on current device form factors --> 
    <splash src="res/screen/ios/[email protected]~universal~anyany.png" /> 
    <splash src="res/screen/ios/[email protected]~universal~comany.png" /> 
    <splash src="res/screen/ios/[email protected]~universal~comcom.png" /> 
    <splash src="res/screen/ios/[email protected]~universal~anyany.png" /> 
    <splash src="res/screen/ios/[email protected]~universal~anycom.png" /> 
    <splash src="res/screen/ios/[email protected]~universal~comany.png" /> 

</platform> 

<preference name="SplashScreenDelay" value="10000" /> 

Weitere Informationen finden Sie auf https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/

+0

hallo, danke für den Tipp gefunden werden. Bisher wird nur das Symbol angezeigt, der Begrüßungsbildschirm jedoch nicht. es zeigt nur eine leere weiße Seite für ein paar Sekunden. –

+0

Ich habe die Schritte hinzugefügt, vielleicht können Sie das Plugin entfernen und die Schritte neu starten. –

Verwandte Themen