Android Seekbar with two thumbs
I too was looking for this, to no avail. So I made a new widget, feel free to use it: https://github.com/anothem/android-range-seek-bar
Seekbar where I can change both min max value with 2 thumbs
Just use the RangeSlider
in Material Components and the method setValues()
<com.google.android.material.slider.RangeSlider
android:id="@+id/slider"
android:valueFrom="0"
android:valueTo="10"
../>
with:
RangeSlider slider = findViewById(R.id.slider);
slider.setValues(1.0f,5.0f);
You can also use:
<com.google.android.material.slider.RangeSlider
android:id="@+id/slider"
android:valueFrom="0"
android:valueTo="10"
app:values="@array/initial_slider_values"
../>
with res/values/arrays.xml
:
<resources>
<array name="initial_slider_values">
<item>1.0</item>
<item>5.0</item>
</array>
</resources>
Note: This requires a minimum of version 1.2.0-beta01
How to set range between two thumbs in range seek bar in android?
For stopping the motion of thumbs when the difference is 4. You can use
if(diff==4) {
bar.setEnabled(false);
}
For getting more clear go to our blog and see How to disable thumbs while dragging in RangedSeekBar section.
Related Topics
Difference Between Build.Gradle (Project) and Build.Gradle (Module)
How to Perform a Fade Animation on Activity Transition
How to Encrypt/Decrypt String in Android
Caused By: Java.Lang.Outofmemoryerror: Bitmap Size Exceeds Vm Budget
Rawquery(Query, Selectionargs)
How to Request Root Access in Android
How to Fix "Failed to Sync Vcpu Reg" Error
Interstitial Admob Ads: "Illegalstateexception: Only Fullscreen Activities Can Request Orientation"
How to Notify Users About an Android App Update
Android Mapview -Setting Zoom Automatically Until All Itemizedoverlay's Are Visible
Insertion of Thousands of Contact Entries Using Applybatch Is Slow
View with Horizontal and Vertical Pan/Drag and Pinch-Zoom
Android: Adb Pull File on Desktop
Return Type for Android Room Joins
Creating an Empty Bitmap and Drawing Though Canvas in Android
Mediaplayer Error (1, -1004) Aka Media_Error_Io Trying to Stream Music on Samsung S3