Android SeekBar with Thumb BELOW the bar

北战南征 提交于 2019-12-11 12:06:00

问题


I'm trying to implement a Seek Bar following the design of the art team. They want a thumb that is not centered vertically, but rather below the progress bar (I would post a picture, but I don't have enough reputation yet to do it). I have been playing with the attributes like the thumbOffset that controls the horizontal offset, but I haven't been able to find anything to indicate a vertical offset or padding. As a result, I'm only able to get a seek bar where the thumb is centered vertically.

I have also tried to extend SeekBar but the method that is calculating the thumb position is private. Does anyone have a solution other than implement a completely new seek bar component from scratch?

Thanks.


回答1:


Here's an idea(I haven't tried it), make a seek bar below the one which you want the user to move, and make it invisible with VIEW.INVISIBLE. Then, in the invisible seek bar's onSeekBarChangedListener, set the first visible seek bar to the value that the second seek bar is on. And finally give the first seekbar the setFocuseable(false) , so that the user doesnt move the seek bar from the wrong place. If this doesn't make sense or work tell me and I will revise/delete this.



来源:https://stackoverflow.com/questions/13711106/android-seekbar-with-thumb-below-the-bar

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