如何添加应用程序pre-装载机/开机画面/开机画面我PhoneGap的Android应用程序 [英] How add an Application Pre-loader/Startup screen/Splash Screen to My PhoneGap Android App
本文介绍了如何添加应用程序pre-装载机/开机画面/开机画面我PhoneGap的Android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直使用的手机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).
这篇关于如何添加应用程序pre-装载机/开机画面/开机画面我PhoneGap的Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文