kishore kumar
kishore kumar

Reputation: 63

How to Customize seekbar with stepvalues

I need seekbar like this :

seekbar

I don't know how to set step values for seekbar if anybody has customized seekbar like kindly help me

Upvotes: 3

Views: 3867

Answers (2)

Zar E Ahmer
Zar E Ahmer

Reputation: 34370

I will suggest three ways. First to use comboSeekBar which does what you need.

See this and this . Library link

And secondly you can simply change step in Seekbar using incrementProgressBy as this Example doing. Or you can setMax to 7 . And for each step multiply the progress with 10 as this Example does.

SeekBar seekBar = (SeekBar)layout.findViewById(R.id.seekbar);
seekBar.setProgress(0);
seekBar.incrementProgressBy(10);
seekBar.setMax(200);

Upvotes: 3

thestar
thestar

Reputation: 5249

You can use,

seekBar.setProgress(0);  // change this to starting point... 
seekBar.incrementProgressBy(10);
seekBar.setMax(200); // change this to whereever you what to stop..

To display a textview below the seekbar,

Since you know the incrementby and max value, you can run a for loop.. and get seek.getProgress() first time, convert it to string and then keep appending incrementby to String....

Upvotes: 0

Related Questions