How to create horizontal progessBar without XML or how to declare XML properties without XML contentView?
I have layout in .java file and I want to set progressBar to horizontal and set its width/location.
RelativeLayout fv = new RelativeLayout(this);
panel = new Panel(this);
fv.addView(panel);
ProgressBar pb = new ProgressBar(this);
//pb.? - progress bar parameters
fv.addView(pb);
setContentView(fv);
Oh, and it can't be a pop-up window. I need progressBar on top of touch-enabled canvas layer..
In the constructor, do this:
ProgressBar pb = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
You can replace the null with an AttributeSet, typically you would need one of Android's AttributSets anyway. You can then set its width/location using the standard View methods.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With