How to create 'Horizontal style' progress bar programmatically in Android?

iuq picture iuq · Jan 4, 2012 · Viewed 22.7k times · Source

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?

Answer

waqaslam picture waqaslam · Jan 4, 2012

use this:

ProgressBar pb = new ProgressBar(context,
                                 null, 
                                 android.R.attr.progressBarStyleHorizontal);