Skip to content
Related Articles

Related Articles

Improve Article

How to add ColorSeekBar in Android

  • Difficulty Level : Hard
  • Last Updated : 23 Feb, 2021
Geek Week

Seekbar is a type of progress bar. We can drag the seekbar from left to right and vice versa and hence changes the current progress. ColorSeekbar is similar to seekbar but we use this to select a color from multiple colors and can select any custom color. With the help of this widget, we can give more control to the user to customize its application according to his need.


  1. Add the support Library in your root build.gradle file (not your module build.gradle file). This library jitpack is a novel package repository. It is made for JVM so that any library which is present in github and bigbucket can be directly used in the application.

    allprojects {
        repositories {
            maven { url "" }
  2. Add the support Library in build.gradle file and add dependency in the dependencies section. This library provides various inbuilt function which we can use to give users maximum independence to customize.

    dependencies {
        implementation 'com.github.rtugeek:colorseekbar:1.7.7'
  3. Now add a array of colors, custom_colors in strings.xml file in values directory.


    <array name="custom_colors">

  4. Now add the following code in the activity_main.xml file.This will add a textview and a colorSeekbar in activity_main. In this file we add our array, custom_colors to the Seekbar.


    <?xml version="1.0" encoding="utf-8"?>
            android:textStyle="bold" />
            app:showAlphaBar="true" />

  5. Now add the following code in the file. onClickListener is added with the seekbar. As the value is changes via seekbar the onClickListener is invoked and color of texts in textview changes.

    package org.geeksforgeeks.colorseekbar;
    import android.os.Bundle;
    import android.widget.TextView;
    public class MainActivity
        extends AppCompatActivity {
        TextView textView;
        protected void onCreate(
            Bundle savedInstanceState)
            textView = findViewById(
                = findViewById(
                new ColorSeekBa
                    r.OnColorChangeListener() {
                        public void
                            int i, int i1, int i2)


Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :