CyclicSeekbar provides an intuitive and customizable cyclic seekbar for Android apps. By integrating it into your project, you can offer users a circular slider to adjust values seamlessly within a defined range.
- Easy Integration: Simply add the library to your project and start using the cyclic seekbar immediately.
- Highly Customizable: Modify its appearance, size, and behavior to fit your app’s design and functionality.
- Smooth Circular Control: Provides a fluid, continuous control experience for users, perfect for volume, brightness, or other circular value adjustments.
To use the cyclic seekbar, follow these steps to update your Gradle files.
In your project-level build.gradle or settings.gradle file, add the following repository:
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
Include the cyclic seekbar library in your app-level build.gradle file. Replace x.x.x with the latest version:
implementation 'com.github.hypersoftdev:CyclicSeekbar:x.x.x'
| Attribute Summary | ||
|---|---|---|
| Attribute | Format | Description |
| cAnimation | boolean | Enable / disable indicator's animation. |
| cAnimationBounciness | int | Parameter "bounciness" applied to the spring physical model for the indicator's animation. |
| cAnimationSpeed | int | Parameter "speed" applied to the spring physical model for the indicator's animation. |
| cBalloonValuesAnimation | string | Animation. Choose among *fade*, *pop* or *scale*. |
| cBalloonValuesRelativePosition | int | Relative position of the balloons. 0 = center, 1 = edge. Values >1 are allowed. |
| cBalloonValuesSlightlyTransparent | boolean | When true, the balloons will be 75% visible. |
| cBalloonValuesTimeToLive | int | How long the popup balloons display. 0 = permanent. |
| cBorderWidth | dimension | Width of the external circle. 0 = disable. |
| cClickBehaviour | string | What is expected when the seekbar is clicked. Options: next value, previous value, reset to default value, let the user select with a popup menu, or define a custom listener. Default: next. Warning: the popup menu is available only with Compat. Warning: the custom listener (a Runnable) should be defined runtime, with setUserBehaviour(). |
| cDefaultState | int | The starting state of the seekbar. |
| cEnabled | boolean | Enable / disable seekbar. |
| cFreeRotation | boolean | Enable free rotation. When false, after reaching maximum or minimum, the indicator will stop; when true, the value will continue in a round-robin fashion. Default: true. |
| cIndicatorWidth | dimension | Width of the line indicator. 0 = disable. |
| cKnobDrawable | drawable | Allows overriding the color configuration to set a drawable as the knob graphics. If present, both kKnob* and kKnobCenter* attributes will be ignored. |
| cKnobDrawableRotates | boolean | When true, the drawable will be rotated accordingly; otherwise, it will stay still. |
| cNumberOfStates | int | Number of possible states. States are numbered from 0 to n-1. This number can be changed runtime, and the indicator will adjust its position accordingly. |
| cSelectedStateMarkerColor | color | Color of the selected line marker. |
| cSelectedStateMarkerContinuous | boolean | If continuous mode is chosen, the knob will act like a gauge, selecting all the markers from the minimum to the current value. When false, only one marker is selected at any time. |
| cShowBalloonValues | boolean | Enable popup balloon values. |
| cStateMarkersAccentColor | color | Change accent color. |
| cStateMarkersAccentPeriodicity | int | How often these markers are shown. 0 = disable. |
| cStateMarkersColor | color | Color of the line markers. |
| cStateMarkersRelativeLength | int | Length of the line markers, relative to the largest possible circle inside the view. 1 = draw from edge to center, 0.5 = draw half length starting from the edge. |
| cStateMarkersWidth | dimension | Width of the line markers. |
| cSwipe | string | Enable swipe. Values: off, vertical, horizontal, both, or circular (default: circular). |
To integrate Cyclic SeekBar into your layout, use the following XML structure with customizable attributes:
<com.hypersoft.cyclicseekbar.CyclicSeekbar
android:id="@+id/cyclic_seekbar"
android:layout_width="100dp"
android:layout_height="100dp"
app:cAnimation="false"
app:cAnimationBounciness="1"
app:cAnimationSpeed="5"
app:cBalloonValuesAnimation="scale"
app:cBalloonValuesRelativePosition="0"
app:cBalloonValuesSlightlyTransparent="true"
app:cBalloonValuesTextSize="1dp"
app:cBalloonValuesTimeToLive="0"
app:cBorderWidth="0dp"
app:cClickBehaviour="nothing"
app:cDefaultState="0"
app:cEnabled="true"
app:cFreeRotation="true"
app:cIndicatorWidth="0dp"
app:cKnobDrawable="@drawable/ic_drawable" <!-- Use your own drawable -->
app:cKnobDrawableRotates="true"
app:cNumberOfStates="50"
app:cSelectedStateMarkerColor="@color/black"
app:cSelectedStateMarkerContinuous="true"
app:cShowBalloonValues="false"
app:cStateMarkersAccentColor="@color/green"
app:cStateMarkersAccentPeriodicity="1"
app:cStateMarkersColor="@android:color/transparent"
app:cStateMarkersRelativeLength="0"
app:cStateMarkersWidth="1dp"
app:cSwipe="circular"
app:layout_constraintTop_toTopOf="parent"
tools:cStateMarkersAccentColor="#B4B6C0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContentView(R.layout.activity_main)
setupCyclicSeekBar()
}
private fun setupCyclicSeekBar() {
val cyclicSeekBar = findViewById<CyclicSeekBar>(R.id.cyclicSeekBar)
cyclicSeekBar.setOnStateChanged(object : CyclicSeekbar.OnStateChanged {
override fun onStateChanged(progress: Int) {
Toast.makeText(this@MainActivity, "Progress: $progress", Toast.LENGTH_SHORT).show()
}
})
}
}
This work would not have been possible without the invaluable contributions of Muhammad Asif. His expertise, dedication, and unwavering support have been instrumental in bringing this project to fruition.
We are deeply grateful for Muhammad Asif involvement and his belief in the importance of this work. His contributions have made a significant impact, and we are honored to have had the opportunity to collaborate with him.
Copyright 2020 Hypersoft Inc
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

