/** * Sets the color of the seek thumb, as well as the color of the popup indicator. * * @param thumbColorStateList The ColorStateList the seek thumb will be changed to * @param indicatorColor The color the popup indicator will be changed to The indicator will * animate from thumbColorStateList(pressed state) to indicatorColor when opening */ public void setThumbColor(@NonNull ColorStateList thumbColorStateList, int indicatorColor) { mThumb.setColorStateList(thumbColorStateList); // we use the "pressed" color to morph the indicator from it to its own color int thumbColor = thumbColorStateList.getColorForState( new int[] {PRESSED_STATE}, thumbColorStateList.getDefaultColor()); mIndicator.setColors(indicatorColor, thumbColor); }
/** * Sets the color of the seek thumb, as well as the color of the popup indicator. * * @param thumbColor The color the seek thumb will be changed to * @param indicatorColor The color the popup indicator will be changed to The indicator will * animate from thumbColor to indicatorColor when opening */ public void setThumbColor(int thumbColor, int indicatorColor) { mThumb.setColorStateList(ColorStateList.valueOf(thumbColor)); mIndicator.setColors(indicatorColor, thumbColor); }