问题描述
我有在启动时闪屏。用下面的编码
i have a splash screen at start up. with the following coding
public class Splash extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread logoTimer = new Thread(){
public void run(){
try{
int logoTimer = 0;
while (logoTimer<5000){
sleep(100);
logoTimer=logoTimer+100;
}
startActivity(new Intent("com.package.MAIN"));
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally{
finish();
}
}
};
logoTimer.start();
}}
现在我只想一个水平进度条添加到上面溅活动在屏幕底部的说..的从而出现闪屏同时进度条应该加载和当它完成下一个活动应该会出现。的
now i just want to add a horizontal progress bar to the above splash activity say at the bottom of the screen.. so as the splash screen appears simultaneously the progress bar should load and when it finishes the next activity should appear.
搜索进度条上几个例子,但没有能够做到我想要的。有与一个对话框,进度条的例子很多。但在这里,我不希望任何对话框。我只需要一个简单的水平进度条我的启动画面。
searched few examples on progress bar but was not able to do what i want. there were many examples for progress bar with a dialog box. but here i don't want any dialog box. i just need a plain horizontal progress bar on my splash screen.
所以有人可以帮助我需要的编码和东西?请! :)
so can someone help me out with required coding and stuffs? pls ! :)
推荐答案
在这里,你走了,写了一个教程如何创建一个进度条闪屏:
Here you go, wrote a tutorial how to create a SplashScreen with a progress bar:
基本上而不是你的线程启动的AsyncTask的,你传递一个关于你progressSpinner到的AsyncTask和线程是下载资源,这将更新(或任何你想做的事情)
Basically instead of your thread it starts an ASyncTask, you pass a reference to your progressSpinner into the ASyncTask and this will update it as the thread is downloading resources (or whatever you want to do)
这篇关于如何实现进度条闪屏? - 机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!