How to make Range seekbar or dual thumbs seekbar in android

Save

In this blog,
I have shown how to make dual thumbs Seekbar or we can say a Range SeekBar in android. But first of all, I will  give the small introduction about the simple Seekbar in android.

Meet with SeekBar

SeekBar is useful user interface element which is used commonly in android applications. A SeekBar is an extension of ProgressBar that allows the selection of numerical values using a natural user thumbs. Basically, SeekBar has a thumb that you can slide to choose a value between 0 and some maximum that you set.

You can touch the thumb and drag left or right to set the current progress or use the arrow keys.

A common usage of Seekbar is our device brightness control and volume control.

How to implement

In this example, I have created a simple Seekbar

and In onCreate method

Screenshot_2
Progress Level 5

Screenshot_1
On Progress

 

Now we have been known that how to make simple Seekbar.

But if we want to make dual thumbs means a Range Seekbar then what android doesn’t give the range Seekbar and if we want to customize Seekbar then we have to write huge lines of code.

Seekbar with dual Thumbs

So, I have shown you how to make the RangedSeekbar by using /android-range-seek-bar.

Actually, RangedSeekbar is a simple SeekBar similar to the default Android one, but with two thumb controls allowing a range to be selected.

Step 1: Add the dependency in app level build.gradle file

Step 2: Make the RangedSeekbar

In XML file,

and in your attrs.xml file

or if you want to make it programmatically then

for float

Step 3: Add the listener and get the min and max value

Some snapshots while using RangeSeekbar in android

Screenshot_20160303-165000             Screenshot_20160303-165038

Screenshot_20160303-165057

Screenshot_20160303-165134

How to disable thumbs while dragging in RangedSeekBar

In below block of code, I have shown how to disable thumbs while dragging if the difference b/w minValue and maxValue is 40 or below 40.

Snap-Shot

Screenshot_2016-04-05-21-21-26

Get the Complete Source Code

For getting the complete project go to this link.

. . .

Leave a comment

23 Comments

css.php

All communication is done through a ticket system. I appreciate the regular almost daily updates of what is being worked on, and communicating changes or updates is easy through this system. Mobikul's response timeframe is quick.

Josh Arnold

Josh Arnold

Owner, Shop ATV Escape

Talk to Sales

Global

Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home