我在更改颜色或progressDialog时遇到问题。我已经看到了很多变更示例,但没有满足我的需要,我需要您的帮助,这是我的代码:
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_DOWNLOAD_PROGRESS:
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setMessage(getApplicationContext().getString(R.string.download));
mProgressDialog.setIndeterminate(false);
mProgressDialog.setMax(100);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setProgressDrawable(new ColorDrawable(android.graphics.Color.BLUE)); // my bad test
mProgressDialog.setCancelable(true);
mProgressDialog.show();
return mProgressDialog;
default:
return null;
}
}
覆盖onCreate
ProgressDialog的方法,并对其进度栏进行任何更改。
ProgressDialog mProgress = new ProgressDialog(this){
@Override
protected void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Now we retrive this dialog ProgressBar
ProgresBar bar = (ProgressBar) findViewById(android.R.id.progress);
//Do what you want with it here
};
};
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句