Dimitri
Dimitri

Reputation: 1924

Seekbar min value 100 and max 0 Android

A vertical seekbar has minimum value 0 and maximum value 1000. Is it possible that at the bottom the seekbar min progress is 1000 and when at top level it becomes 0. The current seekbar range is

seekBarTop.setProgress(0);
seekBarTop.incrementProgressBy(10);
seekBarTop.setMax(1000);

Upvotes: -2

Views: 3481

Answers (2)

Tarun Umath
Tarun Umath

Reputation: 910

     SeekBar sbTolerance = findViewById(R.id.sbTolerance);



    sbTolerance.setMax(100);

 sbTolerance.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
                int j = 100 - i;
                Toast.makeText(AlertSetting.this, ""+j, Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                if(seekBar.getProgress()==0||seekBar.getProgress()==100)
                    enableManualButton();
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {

            }
        });

Upvotes: 0

Iamat8
Iamat8

Reputation: 3906

As SeekBar extend ProgressBar and by definition ProgressBar is Visual indicator of progress in some operation. So it is just a partition used to show current progress/status..

As you have defined setProgress(0) and setMax(1000) it creates a seekbar with 100 partition with 10 increments...So I would suggest you to get current progress, and reduce it by 1000 (1000 - value) to get your final value (you can create a method return final value).....this will show your progress from 1000----0.

Upvotes: 1

Related Questions