-
Notifications
You must be signed in to change notification settings - Fork 26
Home
李涛 edited this page Aug 4, 2024
·
16 revisions
- 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)'
}
The latest version is:
- 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
}
})
-
M3 Style
-
WeRead Style
-
Color Pick Style
-
Custom Thumb Drawable Style
-
Lottie Animation style
-
Tiktok Style
-
BiliBili Style
-
YouTube video preview style
-
YouTube graph style
-
Effect with issues #13
-
Vertical Mode