I am going to change color of the SeekBar with below code.
public void setColor(SeekBar view, Integer color) {
LayerDrawable drawable = (LayerDrawable) view.getProgressDrawable().getCurrent();
Drawable progress = drawable.findDrawableByLayerId(android.R.id.progress);
progress.setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
Some of devices ran the code with no error. But some of devices will return java.lang.ClassCastException android.graphics.drawable.NinePatchDrawable cannot be cast to android.graphics.drawable.LayerDrawable.
Is anyone have workaround for this issue ?