如何添加应用程序pre-装载机/开机画面/开机画面我PhoneGap的Andr​​oid应用程序应用程序、开机画面、装载机、pre

由网友(-边境矢梦°)分享简介:我一直使用的手机Gap.It工作创造了一个Android应用程序fine.How我加了pre-loader映像我的App.Now它显示一个白色的页面载入该应用程序。I have created a Android app using phone Gap.It works fine.How I add a pre-lo...

我一直使用的手机Gap.It工作创造了一个Android应用程序fine.How我加了pre-loader映像我的App.Now它显示一个白色的页面载入该应用程序。

I have created a Android app using phone Gap.It works fine.How I add a pre-loader image to My App.Now it show a white page while loading the application.

帮助是非常AP preciated, 感谢, VKS。

Help is highly appreciated, Thank, VKS.

推荐答案

如果你的意思是pre-装载机形象闪屏是指以下code;

If you mean pre-loader image has Splash screen refer the following code;

对于PhoneGap的:

public class MyDefaultActivity extends Activity {

   public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setIntegerProperty("splashscreen", R.drawable.splash); // Displays the splash screen for android
        super.loadUrl("file:///android_asset/www/index.html",3000); // Second parameter is duration for delay of splash screen
    }
}

对于Android原生的应用程序:

public class MySplashScreen extends Activity {
    private CountDownTimer lTimer;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.splashscreen); // Contains only an LinearLayout with backround as image drawable

        lTimer = new CountDownTimer(5000, 1000) {
            public void onFinish() {
                closeScreen();
            }
            @Override
            public void onTick(long millisUntilFinished) {
                // TODO Auto-generated method stub
            }
        }.start();
    }

    private void closeScreen() {
        Intent lIntent = new Intent();
        lIntent.setClass(this, MyLauncherActivity.class);
        startActivity(lIntent);
        finish();
    }
}

请确保一个名为 splash.png 是present为 RES /绘制,华电国际/ splash.png (RGBA)。

Make sure a file called splash.png is present as res/drawable-hdpi/splash.png (RGBA).

阅读全文

相关推荐

最新文章