Skip to content
Related Articles

Related Articles

Croller in Android
  • Difficulty Level : Medium
  • Last Updated : 23 Feb, 2021

In this article, we will learn about how to add Croller in android. Croller is used to implement circular Seekbar in android. 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. This is how a Croller look like.
croller in android

Table of Attributes

XML AttributeJava set methodFunctionality
anticlockwisesetAntiClockwise(boolean anticlockwise)Set the direction of rotation
progresssetProgress(int progress)Set the current progress of the seekbar
labelsetLabel(String str)Set the label
label_sizesetLabelSize(int size)Set the label size
label_colorsetLabelColor(int color)Set the label color
is_continuoussetIsContinuous(boolean bool)Set whether seekbar is conitnuous or discrete
maxsetMax(int max)Set the maximum value of the seekbar
minsetMin(int min)Set the minimum value of the seekbar (Default is 1)
start_offsetsetStartOffset(int offset)Set the seekbar start offset angle from bottom horizontal center
sweep_anglesetSweepAngle(int angle)Set the total angle covered by the seekbar
progress_primary_stroke_widthsetProgressPrimaryStrokeWidth(float width)Set the primary progress thickness for continuous type
progress_secondary_stroke_widthsetProgressSecondaryStrokeWidth(float width)Set the secondary progress thickness for continuous type
progress_primary_circle_sizesetProgressPrimaryCircleSize(float size)Set the primary progress circle size for discrete type
progress_secondary_circle_sizesetProgressSecondaryCircleSize(float size)Set the secondary progress circle size for discrete type
indicator_widthsetIndicatorWidth(float width)Set the progress indicator width
indicator_colorsetIndicatorColor(int color)Set the progress indicator color
progress_primary_colorsetProgressPrimaryColor(int color)Set the progress primary(active) color
progress_secondary_colorsetProgressSecondaryColor(int color)Set the progress secondary(inactive) color
progress_radius setProgressRadius(float radius)Set the radius of the progress arc
main_circle_radiussetMainCircleRadius(float radius)Set the main(front) circle radius
back_circle_radiussetBackCircleRadius(float radius)Set the back circle radius
main_circle_colorsetMainCircleColor(int color)Set the main(front) circle color
back_circle_colorsetBackCircleColor(int color)Set the back circle color

Getting Started

Step 1: Add the support Library in build.gradle file and add dependency in the dependencies section.

implementation 'com.sdsmdg.harjot:croller:1.0.7'

Step 2: Add the following code in activity_main.xml file. In this file we add our Croller to the layout.


<?xml version="1.0" encoding="utf-8"?>
        app:label="Set Difficulty Level"

Step 3: Add the following code in file. In this we add setOnCrollerChangeListener() to our croller so whenever there is a change in progress setOnCrollerChangeListener() get invoked automatically.


package org.geeksforgeeks.croller
import android.os.Bundle;
import android.widget.Toast;
import com.sdsmdg.harjot.crollerTest.Croller;
import com.sdsmdg.harjot.crollerTest.OnCrollerChangeListener;
public class MainActivity extends AppCompatActivity {
    protected void onCreate(Bundle savedInstanceState) {
        Croller croller = findViewById(;
        // when there is a change in the progress of croller
        // this function get invoked automatically
            new OnCrollerChangeListener() {
            public void onProgressChanged(Croller croller,
                        int progress) {
            // when the user is starting to change the progress
            // this function gets invoked automatically.
            public void onStartTrackingTouch(Croller croller) {
                      "Start", Toast.LENGTH_SHORT).show();
            // when the user stops to change the progress
            // this function gets invoked automatically.
            public void onStopTrackingTouch(Croller croller) {
                      "Stop", Toast.LENGTH_SHORT).show();

Run as Emulator

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 :