开发者

Android: SeekBar Increment Value - How To

开发者 https://www.devze.com 2023-01-09 23:29 出处:网络
My SeekBar (slider) works just fine but, it increments/decrements by one\'s as I slide my finger but, I want to change the increment value to a constant, such as 5.I tried using

My SeekBar (slider) works just fine but, it increments/decrements by one's as I slide my finger but, I want to change the increment value to a constant, such as 5. I tried using

slider.incrementProgressBy(5);

to do it but, it doesn't work (note: I placed it in different locations, inside and outside the action listener, but it didn't work).

Here are the two lines that relate to this:

slider.incrementProgressBy(5);
validBpm = slider.getProgress();

Those lines are currently inside the SeekBar's touch listener.

I imagine it's simple and I'开发者_Python百科m overlooking the obvious - any suggestions? Thanks...


AFAIK, you cannot change the SeekBar increment value. Instead, change your max (setMax()) and use multiplication. For example, rather than 0 to 25 incrementing by 5, use 0 to 5 incrementing by one, then multiply the SeekBar value by 5 to get your result.

0

精彩评论

暂无评论...
验证码 换一张
取 消