Android SeekBar

Android SeekBar is an extension of ProgressBar,which contains a thumb which is draggable. The thumb can be moved left or right and can give some actions based on the progress value. The methods provided by  setOnSeekBarChangeListener will help to perform the actions using SeekBar.

Let us seen an example for android seekbar.For implementing SeekBar in android you need to add the following code to your layout file.


Here i am setting the maximum value of seekbar. So this seekbar progress value will be till 100;

And Below is the code for your activity.You need or refer the seekbar in the layout and need to define setOnSeekBarChangeListener.

SeekBar sb_value = (SeekBar) findViewById(;
sb_value.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {



    public void onStartTrackingTouch(SeekBar seekBar) {


    public void onStopTrackingTouch(SeekBar seekBar) {


You must get the following output after running the code.



Refer the following tutorial to see a simple example of SeekBar in android.The tutorial will explain how to adjust the brightness of an imageview in android.

How to adjust the brightness of a image using seekbar in android


About the author

Hi guys, i am the author of codesfor. I am a B.Tech graduate currently working as an App developer. Apart from job i am a blogger and a freelancer.

One Comment

  1. Game October 3, 2016 Reply

Add a Comment

Your email address will not be published. Required fields are marked *