| View documentation | 中文
- Maven library dependency
dependencies {
implementation 'io.github.litao0621:nifty-slider:(latest version)'
// Added effect for Sliders (Optional Features)
implementation 'io.github.litao0621:nifty-slider-effect:(latest version)'
}
- Add it to the layout file
<com.litao.slider.NiftySlider
android:id="@+id/nifty_slider"
android:layout_width="match_parent"
android:layout_height="148dp"
android:padding="16dp"
android:value="50"
android:valueFrom="0"
android:valueTo="100"
app:trackColor="@color/m3_demo_track_color"
app:trackColorInactive="@color/m3_demo_track_inactive_color"
app:thumbColor="@color/m3_demo_thumb_color"
app:thumbShadowColor="@color/white"
app:haloColor="@color/m3_demo_halo_color"/>
- Registers a callback to be invoked when the slider changes
binding.niftySlider.setOnValueChangeListener { slider, value, fromUser ->
//do something with float value
}
binding.niftySlider.setOnIntValueChangeListener { slider, value, fromUser ->
//do something with int value
}
binding.niftySlider.setOnSliderTouchListener(object :NiftySlider.OnSliderTouchListener{
override fun onStartTrackingTouch(slider: NiftySlider) {
//do something on touch start
}
override fun onStopTrackingTouch(slider: NiftySlider) {
//do something on touch stop
}
})
10. Effect with issues #13
You are welcome to send push requests (Just remember to add you name to the contributers list) or raise issues
If you feel this library has helped you, you can click the Star button to support the author. You can also buy the author a cup of coffee.Thanks very much.:smiley:
Copyright 2023 litao
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.