问题
I need to show the secondary progress of a ProgressDialog on Android, but it shows only the first progressbar in the dialog.
This is the code I use:
progress = new ProgressDialog(this);
progress.setIndeterminate(false);
progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progress.setProgress(25);
progress.setSecondaryProgress(10);
progress.show();
回答1:
That seems to have no effect if set before the dialog is shown.
Try:
final ProgressDialog progress = new ProgressDialog(this);
progress.setIndeterminate(false);
progress.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progress.setOnShowListener(new OnShowListener() {
public void onShow(DialogInterface dialog) {
progress.setProgress(50);
progress.setSecondaryProgress(75);
}
});
progress.show();
EDIT

来源:https://stackoverflow.com/questions/10385007/how-to-show-the-secondaryprogress-in-a-android-progressdialog