'how to change the Slider's thumb Material Component Android with image?
I am trying to use the slider in Material Design component, but stuck for styling the thumb. My design requirement needs shadow surrounding the thumb. From the documentation only show how to change the background thumb. Is it possible to change the thumb with image?
Solution 1:[1]
At the moment it's implemented in the beta version.
Edited. Methods added in the beta version:
setCustomThumbDrawable(@NonNull Drawable drawable)
setCustomThumbDrawable(@DrawableRes int drawableResId)
setCustomThumbDrawablesForValues(@NonNull @DrawableRes int... customThumbDrawableResIds)
setCustomThumbDrawablesForValues(@NonNull Drawable... customThumbDrawables)
Solution 2:[2]
Create your drawable and use:
android:thumb="@drawable/custom_thumb"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Ann Developer |