the default start value for seekbar is 0. Is it possible to change that value to 10? Please explain me how to set the value.
Thanks in advance.
the default start value for seekbar is 0. Is it possible to change that value to 10? Please explain me how to set the value.
Thanks in advance.
change from XML : to change default value of seekbar use android:progress=""
property of seekbar
android:progress="10"
android:max="100"
change from Java : to change default value of seekbar
use setProgress(int progress)
method
yourSeekbar.setProgress(10);
So I've been trying to do the same thing only for an arc progress bar. The way that I managed to achieve my desired results was by manipulating my .setProgress
and .setMax
values.
If you want to start at 10 and have a max of 100, your code should follow something like this:
progressBar.setProgress(_______-10);
progressBar.setMax(90);
For setProgress it should be the number you want minus 10.. this way if you have 10, then the calculation (10-10) would give you 0 which will not move your progress bar.
For setMax.. the reason why you need to subtract 10 is because if you put 100 as your max and say the progress is (100-90).. it will give you 90 (your max)... in other words if we weren't doing any calculations for setProgress, then your setMax should remain the same, but since we did a calculation for setProgress, you have to do the same calculation for your set max.
You can set it via xml, i dont know if you still need this but here is the answer:
android:min="10000" android:max="100000" android:progress="5000"
With the unit your seekBar is using, use two equal signs to make a default value.
In a previous case I had before, I used the following:
paintBrush.strokeWidth == 8f
'paintBrush', was the pen I was using in my drawing app, and strokeWidth, refers to how thick the pen is. I used two 'equal signs', meaning that this value can be changed, then followed it with the default value (thickness of the pen).
I am also new to android studio, but I do this. Hope it helps!! *Sorry answer is late.