1

I'm using Slider Widget from google Material library and I need to prevent user from slide the widget for a while. Is there any way to do that? (I prefer to not using onPositionChanged() method)


<com.google.android.material.slider.Slider
        android:id="@+id/speakerVolumeBottomSheetSeekbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/SliderMaterialTheme"
        app:labelBehavior="gone"
        android:value="0.5"
        app:thumbColor="@color/colorAccent"
        app:trackColorActive="@color/colorAccent"
        app:trackColorInactive="@color/white_22_opacity" />

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Hamid Sj
  • 983
  • 7
  • 19

1 Answers1

5

Use:

   <com.google.android.material.slider.Slider
        android:enabled="false"/>

or programmatically:

slider.isEnabled = false 
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841