如何在CordovaActivity中显示splashScreen

时间:2015-04-27 15:11:40

标签: android cordova phonegap-plugins

现在我使用以下代码继续使用splashScreen for phonegap app:

public class MainActivity extends CordovaActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        // Set by <content src="index.html" /> in config.xml

        loadUrl(launchUrl);
    }
}

config.xml中

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.splashApp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <preference name="loglevel" value="DEBUG" />
      <feature name="SplashScreen">
      <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
  </feature>
      <preference name="splashscreen" value="screen" />
 <preference name="splashScreenDelay" value="10000" />

    <feature name="Whitelist">
        <param name="android-package" value="org.apache.cordova.whitelist.WhitelistPlugin" />
        <param name="onload" value="true" />
    </feature>
    <allow-intent href="market:*" />
    <name>SplashApp</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
</widget>

问题:

splashScreen似乎没有尝试过很多解决方案可以修复它可以帮助我解决这个问题。

尝试:

http://cordova.apache.org/docs/en/3.1.0/cordova_splashscreen_splashscreen.md.html#splashscreen.show

Splash screens not working in PhoneGap Build

CordovaActivity中的

setIntegerProperty函数将于2013年7月在3.0中弃用。所以我们如何使用它。

1 个答案:

答案 0 :(得分:0)

添加

super.init();

进入MainActivity