movement of seekbar on button click

白昼怎懂夜的黑 提交于 2019-12-12 10:24:33

问题


i have a query to ask.

How can i move a seekbar on a button click incrementing by 0.25

i.e i have created two buttons + for increase and - for decrease.Is it possible??

I have set "max" of seekbar 60 and onProgress change I am multiplying the progress value by 0.25 to increment my precision by 0.25. But my seekbar is not moving on each button click i.e for value 0 to 1 it doesn't move from 0.25 to 0.75, after clicking from 0.75 it moves to 1. I am not getting it to move on each value.


回答1:


AFAIK,you cannot use float value as progress of spinner. It must be an Integer value.so better you set maximum progress as an integer value that is total of how many clicks you want user to reach to right most side of spinner.

Ex. you want user to give 10 clicks for going from left to right in spinner,just set maximum progress as 10.

So if you want behavior like you asked for,then..

For Examlple: you want user to see 1 to 5 progress incremented by 0.25 each time he clicks on spinner,then set your progess as 5*4=20 and then show increment as it is added by 0.25 in each click.but actually you will have to increment progress by 1 only.



来源:https://stackoverflow.com/questions/9000289/movement-of-seekbar-on-button-click

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