- Use Gradle
implementation 'com.xdevelopers.iosseekbar:IOSSeekbar:1.0.0'
- or Maven
<dependency>
<groupId>com.xdevelopers.iosseekbar</groupId>
<artifactId>IOSSeekbar</artifactId>
<version>1.0.0</version>
<type>pom</type>
</dependency>
- XML Decleration
<com.xdevelopers.iosseekbar.IOSColorSeekBar
android:id="@+id/iosColorSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:layout_centerInParent="true"
app:shadowLayer="true"/>
- Attributes
Seekbar Attribute | Description |
---|---|
app:cornerRadius="4dp" | Sets the corner radius of bar. |
app:barHeight="8dp | Sets the height of color bar. |
app:shadowLayer="true" | Sets the thumb shadow. |
app:shadowLayerRadius="10" | Set the thumb shadow layer radius. |
app:shadowLayerColor="#e0e0e0" | Set the thumb shadow layer color. |
- Color brightness
colorSlider.setColorBrightness(0.8f)
- Listener
colorSlider.setOnColorChangeListener(object : IOSColorSeekBar.OnColorChangeListener {
override fun onColorChangeListener(color: Int) {
colorView.setBackgroundColor(color)
}
override fun onThumbClickedListener(color: Int) {
colorView.setBackgroundColor(color)
Toast.makeText(this@MainActivity, "Thumb clicked", Toast.LENGTH_SHORT).show()
}
})
Copyright 2020 xDevelopers.co
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.