LinearLayout spinnerLayout = new LinearLayout(this);
addContentView(spinnerLayout,new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
ProgressBar spinner = new ProgressBar(this);
spinnerLayout.addView(spinner);
Of course, the spinner is in the top left corner. I’ve searched and found the xml method, but I want a java solution.
That should work