Use image filters to change color of default State List Drawables (including SeekBar):
// Change seekbar color to green.
SeekBar sb = (SeekBar) findViewById(R.id.seekBar1);
sb.getProgressDrawable().setColorFilter(0xFF00FF00, PorterDuff.Mode.MULTIPLY);
sb.getThumb().setColorFilter(0xFF00FF00, PorterDuff.Mode.MULTIPLY);
The method getThumb
is only available since API 16+ (Jelly Bean).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…