Skip to content

[Slider] "click" does not trigger onChangeListener #904

@romuald

Description

@romuald

Description:

When using a Slider, the onChange listener does not trigger when clicking on the slider itself.
Note that dragging the handle works as expected.

Expected behavior:
When clicking on the slider, the onchange listener should be called

Source code:

    <com.google.android.material.slider.Slider
        android:id="@+id/max_size_slider"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="4dp"
        android:layout_marginEnd="4dp"
        android:valueFrom="512"
        android:valueTo="4096"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/max_size_label"/>
mSlider.setOnChangeListener(new Slider.OnChangeListener() {
            @Override
            public void onValueChange(Slider slider, float value) {
                Log.i("MTAG", String.format("value changed to %.f", value));
            }
        });

Android API version: 26

Material Library version: 1.2.0-alpha0

Device: Emulator

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions