syedowaisali / crystal-range-seekbar

537 stars 164 forks source link

how can i make the textview move with the thumb? #61

Closed xxwn446 closed 6 years ago

xxwn446 commented 7 years ago

i want to know how can i make the textview move with the thumb

xxwn446 commented 7 years ago

who can help me?thanks very much

daesu commented 6 years ago

@xxwn446 Not an efficient solution but this is what I'm doing.

Get the x coordinates of the thumbnail Rect with;

crystalSeekBar.getLeftThumbRect().left;

This value will allow you to align the Left coordinates of your TextView with the Left coordinates of the bounds of the thumb.

TextView.setX(crystalSeekBar.getLeftThumbRect().left));

xxwn446 commented 6 years ago

thank you very much!!!

------------------ 原始邮件 ------------------ 发件人: "Pól Ó Riain";notifications@github.com; 发送时间: 2017年8月9日(星期三) 下午4:30 收件人: "syedowaisali/crystal-range-seekbar"crystal-range-seekbar@noreply.github.com; 抄送: "___陌 离"1003860152@qq.com; "Mention"mention@noreply.github.com; 主题: Re: [syedowaisali/crystal-range-seekbar] how can i make the textviewmove with the thumb? (#61)

@xxwn446 Not an efficient solution but this is what I'm doing.

Get the x coordinates of the thumbnail Rect with;

crystalSeekBar.getLeftThumbRect().left;

This value will allow you to align the Left coordinates of your TextView with the Left coordinates of the bounds of the thumb.

TextView.setX(crystalSeekBar.getLeftThumbRect().left));

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

lucasharada commented 6 years ago

@daesu Didn't work for me. My crystalSeekBar object doesn't have getLeftThumbRect method.

daesu commented 6 years ago

@lucasharada It's a method I am seeing in crystalSeekBar.java. You can see it here ; https://github.com/syedowaisali/crystal-range-seekbar/blob/master/crystalrangeseekbar/src/main/java/com/crystal/crystalrangeseekbar/widgets/CrystalSeekbar.java on L287

lucasharada commented 6 years ago

@daesu Weird. I'm getting this error:

Error:(130, 33) error: getLeftThumbRect() has protected access in CrystalRangeSeekbar

I'm using the latest version available (v 1.1.3) as included below: compile 'com.crystal:crystalrangeseekbar:1.1.3'

daesu commented 6 years ago

@lucasharada You are looking at the CrystalRangeSeekbar.java file, not CrystalSeekbar.java.

The CrystalRangeSeekbar is for selecting a range of values, the CrystalSeekbar only has one thumb. In CrystalRangeSeekbar the getLeftThumbRect() method is protected but in CrystalSeekbar the getLeftThumbRect() method is public.

lucasharada commented 6 years ago

@daesu Oh, I get it. This won't work for me, but thanks anyway!