0

I want to create a seekbar which will change it's progress only when user drag it, It should not change progress when user touch on it.

Does any one done like this before any help please

Thank You Sandip Jadhav

Sandip Jadhav
  • 7,377
  • 8
  • 44
  • 76

2 Answers2

0

I dont know what you really wanted to know.

but use handler every after 1 sec and set your seekprogress inside of it. e.g:

    runnable = new Runnable() {

        @Override
        public void run() {

            bar.setProgress(bar.getProgress() + 1);



        }
    };
Ahmad Arslan
  • 4,498
  • 8
  • 38
  • 59
0
public class Slider extends SeekBar {

private Drawable mThumb;

public Slider(Context context) {
    super(context);

}

public Slider(Context context, AttributeSet attrs) {
    super(context, attrs);

}

@Override
public void setThumb(Drawable thumb) {
    super.setThumb(thumb);
    mThumb = thumb;
}

@Override
public boolean onTouchEvent(MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_DOWN) {

        if (event.getX() >= mThumb.getBounds().left
            && event.getX() <= mThumb.getBounds().right
            && event.getY() <= mThumb.getBounds().bottom
            && event.getY() >= mThumb.getBounds().top) {

        super.onTouchEvent(event);
    } else {
        return false;
    }
} else if (event.getAction() == MotionEvent.ACTION_UP) {
    return false;
} else {
    super.onTouchEvent(event);
}

    return true;
}}

Found answer at below link

Prevent single tap from changing SeekBar progress

Community
  • 1
  • 1
Sandip Jadhav
  • 7,377
  • 8
  • 44
  • 76