In this article, RangeSeekbar is implemented in an application in android. 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. Here we use the RangeSeekbar library to add custom seekbar in our app. This library provides us various features like steps, mode, thumbDrawable, etc which makes it way better than seekbar provided by android.
Step 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.
Step 2: Add the support library in build.gradle file and add the dependency in the dependencies section. Through this directly RangeSeekbar will be used in the XML.
Step 3: Create a string-array in strings.xml file present in the values folder.
Step 4: Add the following code in the activity_main.xml file. In this file, seekbar is added to the layout and the important tag like steps, thumbDrawable, mode, and many more are added according to the requirement.
Step 5: Add the following code in MainActivity.kt file. Here setOnRangeChangedListener is added with the seekbar. It is invoked when the user changes the seekbar bar and shows the percentage of progress to which it is changed.
Refer to the official documentation for more information.
- How to add a custom styled Toast in Android using Kotlin
- How to Add OpenCV library into Android Application using Android Studio?
- Android | How to add Radio Buttons in an Android Application?
- How to create project in Android Studio using Kotlin
- How to send message on WhatsApp in Android using Kotlin
- Running User Interface Thread in Android using Kotlin
- How to Implement Tabs, ViewPager and Fragment in Android using Kotlin?
- How to Create a Splash Screen in Android using Kotlin?
- Why Kotlin will replace Java for Android App Development
- Android EditText in Kotlin
- Android LinearLayout in Kotlin
- Android RelativeLayout in Kotlin
- Android ListView in Kotlin
- Android FrameLayout in Kotlin
- Android TableLayout in Kotlin
- Android Toast in Kotlin
- Android Fade In/Out in Kotlin
- Android Slide Up/Down in Kotlin
- Android Animations in Kotlin
- Android progress notifications in Kotlin
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.