Closed ShowMeThe closed 4 years ago
It seems like the bug you're encountering is that dragging the slider to a new value invokes the onChangeListener
, but just selecting a new value without dragging the slider to the new value does not invoke the onChangeListener
. If that's not the case, please clarify the issue.
Assuming this is the issue, I was able to reproduce this and I'll bring it to the attention of the engineer currently developing the slider.
yes,as you say,not only dragging a new value but also selecting should invokes the onChangeListener.
Okay thank you for clarifying.
In 1.2.0-alpha03
we added a fix to prevent the Slider from intercepting scroll events from the parent. It looks like in this case it's no longer dispatching the change because we avoid handling the touch event unless there is enough horizontal movement. I'll take a look.
I also can't set slider to a value by selecting it. New value is selected only when I drag of swipe the slider. 1.2.0-alpha06
@pekingme It's still there in latest stable and latest alpha.
Thought maybe this can be a fix :
slider.setOnClickListener(v1 -> listener.onValueChange(slider, slider.getValue(), true));
But it didn't work.
one could misuse setLabelFormatter for that purpose. But just be aware that it gets called multiple times per click and that you should not overload it.
Description: When I update the libray from com.google.android.material:material:1.2.0-alpha02 to com.google.android.material:material:1.2.0-alpha03, but when I select a new value the tooltip didn't show and the method of onChange didn't work,the same problem occur in the catalog
Expected behavior: it should working like 1.20-alpha02
Source code:
Android API version: Android Q
Material Library version: com.google.android.material:material:1.2.0-alpha03
Device: oneplus 6