androidkotlinandroid-view

Is a multicolored Android slider available as a library?


I want to create this type of slider

slider-image

I don't want the code but the directions. what is the best thing to do this?


Solution

  • Since you refer to the view you want as a "slider", I assume that you are thinking about using something from the Material Design library. My personal experience with the Material Design views are that they primarily enforce the MD guideline and are not very flexible although they may work for you in this case.

    Is there any similar library project available?

    As for libraries, it looks like the other answers point to some that may be capable of what you are looking for.

    Is there any similar view already available natively.

    I suggest that you take a look at using a SeekBar not because I think that it is necessarily better, but I believe that you can get the result you want with a little effort that would not have external dependencies other than the standard libraries.

    Here is another answer of mine that explains how to build a SeekBar similar in structure that you are looking for. Your background would be the rounded rectangle with gradient shading. The background colors can be defined as explained here. Your seek bar can be built using a LayerList. The layer list can be defined in XML and modified in code. You can also forgo the layer list and draw that seek bar programmatically or fit everything into one drawable. Which you do will depends on your design constraints.

    The thumb can easily be a custom thumb.

    You will likely wind up with mostly XML but some code but not much. I would consider placing the code in a custom view that extends from a standard SeekBar.