Using new material design slider com.google.android.material.slider.Slider
. The documentation is quite poor for it as it has been just recently released. Trying to get value from slider but no luck for now. In other words, what would be a slider's equivalent of setOnProgressChanged { }
from Seekbar.
Slider slider = findViewById(R.id.slider);
slider.addOnSliderTouchListener(touchListener);
Then
private final OnSliderTouchListener touchListener =
new OnSliderTouchListener() {
@Override
public void onStartTrackingTouch(Slider slider) {
}
@Override
public void onStopTrackingTouch(Slider slider) {
}
};
For more details, Check SliderMainDemoFragment.java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With