Splashscreen

Splashscreen

표시 하 고 응용 프로그램의 시작 화면을 숨깁니다.

메서드

기능 액세스

버전 3.0, 코르도바 플러그인으로 장치 수준 Api를 구현합니다. CLI의 사용 plugin 명령 설명에 명령줄 인터페이스를 추가 하거나 프로젝트에 대 한이 기능을 제거 하려면:

    $ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git
    $ cordova plugin rm org.apache.cordova.core.splashscreen

이 명령은 모든 타겟된 플랫폼에 적용 하지만 플랫폼 관련 구성 설정을 아래에 설명 된 수정:

일부 플랫폼은 특별 한 구성이 필요 없이이 기능을 지원할 수 있습니다. 플랫폼 지원에 대 한 참조.

설치

안 드 로이드

  1. 안 드 로이드 프로젝트의 시작 화면 이미지 복사 res/drawable 디렉터리. 각 이미지에 대 한 크기 이어야 합니다.

  2. xlarge (xhdpi): 적어도 960 × 720

  3. 대형 (hdpi): 640 × 480 이상
  4. 매체 (mdpi): 적어도 470 × 320
  5. 작은 (ldpi): 적어도 426 × 320

    시작 화면에 대 한 9 패치 이미지 를 사용 해야 합니다.

  6. 에 onCreate 확장 클래스의 메서드 DroidGap , 다음 두 줄을 추가:

    super.setIntegerProperty("splashscreen", R.drawable.splash);
    super.loadUrl(Config.getStartUrl(), 10000);
    

    첫 번째 줄에서 splashscreen으로 표시 하려면 이미지를 설정 합니다. 당신이 이름을 이미지 아무것도 이외의 경우 splash.png ,이 줄을 수정 해야 합니다. 두 번째 줄은 정상적인 super.loadUrl 선, 하지만 그것은 시작 화면에 대 한 시간 제한 값을 지정 하는 두 번째 매개 변수. 이 예제에서 시작 화면 10 초 동안 표시 됩니다. App 받게 되 면 스플래시 화면을 해제 하는 deviceready 이벤트, 전화는 navigator.splashscreen.hide() 방법.

iOS

IOS 프로젝트에 스플래시 스크린 이미지를 복사 Resources/splash 디렉터리. 만 iPad 또는 아이폰 지원 장치에 대 한 이미지를 추가 합니다. 각 이미지의 크기 이어야 합니다.


splashscreen.show

시작 화면을 표시합니다.

navigator.splashscreen.show();

설명

이 메서드는 응용 프로그램의 시작 화면을 표시합니다.

지원 되는 플랫폼

빠른 예제

navigator.splashscreen.show();

전체 예제

<!DOCTYPE html>
<html>
  <head>
    <title>Splashscreen Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Wait for device API libraries to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // device APIs are available
    //
    function onDeviceReady() {
        navigator.splashscreen.show();
    }

    </script>
  </head>
  <body>
    <h1>Example</h1>
  </body>
</html>

splashscreen.hide

시작 화면을 닫습니다.

navigator.splashscreen.hide();

설명

이 메서드는 응용 프로그램의 시작 화면을 일축 한다.

지원 되는 플랫폼

빠른 예제

navigator.splashscreen.hide();

전체 예제

<!DOCTYPE html>
<html>
  <head>
    <title>Splashscreen Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Wait for device API libraries to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // device APIs are available
    //
    function onDeviceReady() {
        navigator.splashscreen.hide();
    }

    </script>
  </head>
  <body>
    <h1>Example</h1>
  </body>
</html>

iOS 특질

config.xml파일의 AutoHideSplashScreen 설정을 해야 합니다 false . 2 초 동안 시작 화면을 숨기고 지연에 다음과 같이 타이머 추가 deviceready 이벤트 처리기:

    setTimeout(function() {
        navigator.splashscreen.hide();
    }, 2000);