I have the following code:
int min = 1;
int max = 255;
seekBar.setMax(max - min);
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int value = progress + min;
}
});
The values: 1 ... 255
The values i'd like to get: 255 ... 1
Pretty stupid question, but i just can't figure out how to reverse this calculation, could someone point me in the right direction?
This should do it :
int value = max - progress;
It will go from 255 (your max) and gradually go to your minimum value which is 1 :(max - ( max - min )) => min = 1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.