I have a seekbar that I want to only allow changing with the thumb/handle portion. If the user taps anywhere else, I'd like that tap to be ignored.
Is there an inherant property to do this? If not, I already know I can set an onTouch listener and return true
to "disable" it, but is there a way to detect when the thumb is tapped so that I can tell onTouch to return false
in that case?
I assume you want to change thumb position via code, which is user restricted.so for that try this.may be could help you.
myseekBar.setOnSeekBarChangeListener( new OnSeekBarChangeListener() {
int originalProgress;
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
originalProgress = seekBar.getProgress();
}
@Override
public void onProgressChanged(SeekBar seekBar, int arg1, boolean fromUser) {
if( fromUser == true){
seekBar.setProgress(originalProgress);
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With