How to add ColorSeekBar 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. 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. Approach:
- 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 bitbucket can be directly used in the application.
XML
- 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.
XML
dependencies { implementation 'com.github.rtugeek:colorseekbar:1.7.7' } |
- Now add a array of colors, custom_colors in strings.xml file in values directory.
strings.xml
<array name="custom_colors">
<item>#219806</item>
<item>#F44336</item>
<item>#FFEB3B</item>
</array>
Please Login to comment...