问题
I am creating a ProgressBar in my app programmatically it is of SPIN style by default however I want it in HORIZONTAL style. I don't see any method/constant to achieve this.
And I don't want to use ProgressDialog as it'd be inconsistent with my App UI theme.
Any suggestions please?
回答1:
use this:
ProgressBar pb = new ProgressBar(context,
null,
android.R.attr.progressBarStyleHorizontal);
回答2:
If you are using a ProgressDialog then, here is a way to change the style of the progressBar in the ProgressDialog.
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
来源:https://stackoverflow.com/questions/8727277/how-to-create-horizontal-style-progress-bar-programmatically-in-android