How to create a ProgressBar programmatically?
Most of the time if you provide an AttributeSet manually you have to use one of Android’s. Luckily, they’ve exposed the attribute set that describes a small progress bar. Use this code: progressBar = new ProgressBar(activity, null, android.R.attr.progressBarStyleSmall);