How to Customize seekbar with stepvalues

时光总嘲笑我的痴心妄想 提交于 2019-12-11 01:34:18

问题


I need seekbar like this :

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


回答1:


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);



回答2:


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....



来源:https://stackoverflow.com/questions/21200502/how-to-customize-seekbar-with-stepvalues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!