I want to customize the SeekBar as shown below in the image.
I'm a beginner in programming and I looked for tutorials, but every where the progress starts in the leftmost corner. Can someone please guide me how can I customize the SeekBar.
So In onProgresschanged.
@Override
public void onProgressChanged(SeekBar seekBar,int progress, boolean fromUser) {
brightness = progress;
putGestureImageOnScreen(doBrightness(imageBitmap, brightness));
}
Thanks.
In Order to the seekBar to Change while you are in the Activity you need to Call the method setProgress(), and pass it a boolean animate value.
What is difference between ProgressBar and SeekBar? An example of SeekBar is your device's brightness control and volume control. Important Note: Attribute of a SeekBar are same as ProgressBar and the only difference is user determine the progress by moving a slider (thumb) in SeekBar.
In Android Discrete SeekBar is just an advancement of progressBar just like the SeekBar, the only difference in SeekBar and discrete SeekBar being that in discrete SeekBar, we can only set the value only to discrete values like 1, 2, 3, and so on.
Seekbars in Android cannot have negative values. Assuming you have specified a value of '100' for your maximum range of the progress bar (for example using setMax(100) or in your xml file using android:max="100"), then you can use this method to move your progress bar to the middle whenever you want (for example in your Activity.onCreate() or wherever else)
yourProgressBar.setProgress(50);
After that you can get the progress value using:
int progress = yourProgressBar.getProgress();
If you want to have a progress value between (e.g.) -50 to +50, then you can simply use:
int progress = yourProgressBar.getProgress();
progress -= 50;
Good luck.
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