I want to block the dragging of a seekbar if a value is true. Is this even possible? I use a seekbar as a switch. If my seekbar value is 0, and I press the button action A started. If my seekbar value is 1 and I press the button action B is started.
I want to prevent that If action A or B is running the seekbar is dragged to another position.
How can I achieve this?
You should set your own onTouchListener and just return true.
seekBar.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
return true;
}
});
Have you tried disabling the view?
Ref: http://developer.android.com/reference/android/view/View.html#setEnabled(boolean)
Update:
https://stackoverflow.com/a/3278616/529691
Ideally you shouldn't be doing this, as this is going to confuse the user. My suggestion is rethink your approach.
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