MultiSlider icon indicating copy to clipboard operation
MultiSlider copied to clipboard

Number display on thumb

Open bidasknakayama opened this issue 10 years ago • 2 comments

Hi

I want to display the value on each thumb. Is this possible ? Could you tell me how to do it ?

Kazu,

bidasknakayama avatar Jan 06 '16 11:01 bidasknakayama

I'd like to display thumb value on Right Upper corner of each thumb. I read your original source code of this library. but This is not possible at easy. Do you have any way to realize this ? I need your help or advice.

if you can add new function, It's very helpful. Here is some example from JavaScript http://www.jqueryscript.net/images/Smooth-Customizable-Range-Slider-Plugin-with-jQuery-jRange.jpg http://webresourcesdepot.com/wp-content/uploads/2012/12/jquery-range-slider.jpg

thank you Kazu

bidasknakayama avatar Jan 08 '16 00:01 bidasknakayama

This is worked for me:

  • add a separate TextView and
  • wrap both the TextView and the MultiSlider into a FrameLayout and
  • align them center in vertical.
  • Then you can align the TextView on the X axis by calling it's setX() method (there is a callback method name setOnThumbValueChangeListener which can be used).
  • You can align it by center horizontally to the thumb's center like this: final Thumb thumb = contestsSizeSlider.getThumb(0); final int left = thumb.getThumb().getBounds().left; final int width = thumb.getThumb().getBounds().width(); contestsSizeMinText.setText(String.valueOf(thumb.getValue())); contestsSizeMinText.setX((left + (width / 2)) - (contestsSizeMinText.getMeasuredWidth() / 2));

Not as nice as it should be but good enough if it's need for you quickly.

CsabaZz avatar Oct 17 '17 16:10 CsabaZz