How to change the warm-up color in accordance with its progress?

I want to create a custom search panel whose progress bar color changes between red and blue as the user changes the course of the panel.

I tried, but only changed the background color, not the color of the progress bar.

seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

            public void onStopTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }

            public void onStartTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }

            public void onProgressChanged(SeekBar seekBar, int progress,
                    boolean fromUser) {


                seekBar.setBackgroundColor(Color.RED + progress);

            }
        });
+5
source share
2 answers

, . progressBackground :

seekBar.getProgressDrawable().setColorFilter("<Color you wish>", PorterDuff.Mode.MULTIPLY);

21 api, getProgressBackgroundTintList getProgressBackgroundTintMode().

+6

All Articles