如何在点击活动中的按钮时带上进度条我在主要活动中有一个按钮,如果我单击按钮我想要显示进度条我不想使用辅助活动为此我已完成2活动,但我需要它在主要活动中完成。android中的进度条onclick按钮?
谢谢
我的代码:
首页活动:
public void load(View v){
Intent intent = new Intent(this,Splash.class);
this.startActivity(intent);
}
飞溅活动:
public class Splash extends Activity {
private long ms = 0;
private long splashTime = 20000;
private boolean splashActive = true;
private boolean paused = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread mythread = new Thread() {
public void run() {
try {
while (splashActive && ms < splashTime) {
if (!paused)
ms = ms + 100;
sleep(100);
}
} catch (Exception e) {
} finally {
Intent intent = new Intent(Splash.this, Home.class);
startActivity(intent);
}
}
};
mythread.start();
}
}
我不downvoting你,但使用progress.setCancelable(false);真是个坏主意。 – 2013-04-23 06:35:28
@Vipul Shah你能告诉我如何显示这个加载屏幕按钮点击简单。 – user2306156 2013-04-23 09:22:41