简体   繁体   English

科尔多瓦闪屏未显示

[英]cordova splash screen is not shown

I am learning phonegap and cordova now I want to run the splash screen, but is is not working 我现在正在学习phonegap和cordova,但我想运行启动画面,但无法正常工作

This is my config.xml 这是我的config.xml

<?xml version='1.0' encoding='utf-8'?>

<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />

<name>Test</name>
<description>Hello World App. to learn phonegap :)</description>
<author email="a.elsayed2010@gmail.com">Amira Elsayed Ismail</author>
<content src="index.html" />
<access origin="*" />

<platform name="android">
    <icon src="res/android/icon.png" density="ldpi" />
    <icon src="res/android/icon.png" density="mdpi" />
    <icon src="res/android/icon.png" density="hdpi" />
    <icon src="res/android/icon.png" density="xhdpi" />


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

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

 </platform>

My MainActivity Code 我的MainActivity代码

   public class MainActivity extends CordovaActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.init();
        loadUrl(launchUrl);

    }
}

I have already installed the splash screen plugin using the following cmd 我已经使用以下cmd安装了启动屏幕插件

cordova plugin add org.apache.cordova.splashscreen

can any one tell me what is the problem here ? 谁能告诉我这里是什么问题?

config.xml is in cordova folder, this will not work unless you have res folder in the same directory, that is not a good place to store these images. config.xml位于cordova文件夹中,除非您在同一目录中有res文件夹,否则这将无法工作,这不是存储这些图像的好地方。 Normally they are stores under the src directory. 通常,它们存储在src目录下。

Try to use a relative address and check that folder is correct, using different image resolutions (you are incorrectly using the same image resolution): 尝试使用相对地址,并使用不同的图像分辨率检查文件夹是否正确(错误地使用相同的图像分辨率):

For example: 例如:

<splash density="port-ldpi" src="../src/www/res/screens/android/screen-ldpi-portrait.png"/>
<splash density="port-mdpi" src="../src/www/res/screens/android/screen-mdpi-portrait.png"/>
<splash density="port-hdpi" src="../src/www/res/screens/android/screen-hdpi-portrait.png"/>
<splash density="port-xhdpi" src="../src/www/res/screens/android/screen-xhdpi-portrait.png"/>
<splash density="land-ldpi" src="../src/www/res/screens/android/screen-ldpi-landscape.png"/>
<splash density="land-mdpi" src="../src/www/res/screens/android/screen-mdpi-landscape.png"/>
<splash density="land-hdpi" src="../src/www/res/screens/android/screen-hdpi-landscape.png"/>
<splash density="land-xhdpi" src="../src/www/res/screens/android/screen-xhdpi-landscape.png"/>  

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM