apptik / MultiSlider

Multi functional slider/seekbar( / rangebar / scrubber) for Android
Apache License 2.0
320 stars 80 forks source link

Add support for change ripple thumb drawable #65

Open KamikX opened 7 years ago

KamikX commented 7 years ago

Hi, it would be possible add support for change ripple thumb drawable ? I have issue with API 21 where android:attr/colorControlHighlight" native is "red", API > 21 works properly like native SeekBar. My idea is replace ripple drawable control_background_multi_material.xml with custom via xml attribute or programmatically. Thanks in advance for the answer.

bmx666 commented 6 years ago

Hi @KamikX, workaround

        MultiSlider multiSlider = findViewById(R.id.range_slider);
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {

            ColorStateList colorStateListRipple = new ColorStateList(
                    new int[][] {{0}},
                    new int[] {Color.GREEN} // ripple color
            );

            RippleDrawable rippleDrawable = (RippleDrawable) multiSlider.getBackground();
            rippleDrawable.setColor(colorStateListRipple);
            multiSlider.setBackground(rippleDrawable); // applying the ripple color
        }
KamikX commented 6 years ago

Hi @bmx666 thanks for workaround 👍