Building Slider-Toggle

How would you go about building this for Android (both XML and Java-wise)? We need to know when the value changes to update the rest of the activity, and read the current value. I couldn't find any libraries to do this, do you know of any?

Slider Design GIF

1 answer

  • answered 2017-11-12 21:13 Anjal Saneen

    Take a look at this library here: Multi-State Toggle Button

    This is how it looks:

    enter image description here

    And it's quite easy to use it:

        mstb:values="@array/planets_array" />

    In your activity:

    MultiStateToggleButton button2 = (MultiStateToggleButton) this.findViewById(;
    button2.setOnValueChangedListener(new ToggleButton.OnValueChangedListener() {
        public void onValueChanged(int value) {
            Log.d(TAG, "Value: " + value);