Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I cancel a "drag" motion on an Android Seekbar?

I've been reading through the docs, and I cannot figure out how to cancel a "drag" on a Seekbar once the bar has been completed.

For example, when I drag the bar to the end, I want an event to happen. However, if I keep my finger on the screen and drag my finger past the SeekBar, it keeps firing off that event even after I reset the progress of the Seekbar. How can I prevent this action from happening?

Thanks

like image 513
Alex Avatar asked May 27 '10 01:05

Alex


People also ask

What is a seek bar in Android?

Android SeekBar is a type of ProgressBar. On touching the thumb on seekbar and dragging it to the right or left, the current value of the progress changes. SeekBar is used for forwarding or backwarding the songs, Video etc. In the setOnSeekBarChangeListener interface is used which provides three methods.

What is the seek bar?

In Android, SeekBar is an extension of ProgressBar that adds a draggable thumb, a user can touch the thumb and drag left or right to set the value for current progress. SeekBar is one of the very useful user interface element in Android that allows the selection of integer values using a natural user interface.

How do I change the size of SeekBar on Android?

Now go to the activity_main. xml create a layout and inside the layout add a SeekBar. Specify the height width of SeekBar and the max progress that you want to use set progress to 0. This will create a customized Seekbar inside activity_main.

Which of the following interface is associated with the default event of SeekBar?

Android SeekBar is a kind of ProgressBar with draggable thumb. The end user can drag the thum left and right to move the progress of song, file download etc. The SeekBar. OnSeekBarChangeListener interface provides methods to perform even handling for seek bar.


1 Answers

Try this..it works fine..

mSeekBar.setEnabled(false);
like image 54
Giridharan Avatar answered Oct 20 '22 02:10

Giridharan