私のアプリは、進行状況バーを含むアクティビティから始まります。このアクティビティは、5 秒後に別のアクティビティに自動的に移行します。スムーズな進行状況バーを 5 秒間使用したい。私はこのコードを試しました:
progressBar = (ProgressBar) findViewById(R.id.prog_bar);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 500);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 1000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 1500);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 2000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 2500);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 3000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 3500);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 4000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 4500);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 5000);
progressBar = (ProgressBar) findViewById(R.id.prog_bar);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 500);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 1000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 1500);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 2000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 2500);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 3000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 3500);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 4000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 4500);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progressBarStatus);
progressBarStatus += 10;
}
}, 5000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
final Intent mainIntent = new Intent(MainPage.this, DashboardActivity.class);
MainPage.this.startActivity(mainIntent);
MainPage.this.finish();
}
}, 4500);
}
}
他に方法がありませんでした。これには、より効率的な方法とスムーズな進行状況バーが必要です....