'How to inflate custom layout in Material tooltip of a Material slider in Android?

I was trying to achieve something similar to the below image by manipulating the Material tooltip inside the Material slider.

enter image description here

I was able to achieve something similar to the below image

enter image description here

I have extended the Slider class and tried different methods to override the tooltip view unfortunately the override methods are very limited for tooltips.

I could only find a few methods like

 override fun getTooltipText(): CharSequence? {
    return super.getTooltipText()
}

and

override fun setTooltipText(tooltipText: CharSequence?) {
    super.setTooltipText(tooltipText)
}

I have tried some lib like PreviewSeekbar etc but which does not fulfil my requirements so I thought of customising the material slider. Any help would be appreciatable.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source