Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android disable seek bar for audio controller

I used the following seek bar for displacing the progress of my audio.

<SeekBar
    android:padding="7dp"
    android:id="@+id/SeekBar01"
    android:layout_width="245dip"
    android:thumb="@drawable/seekthumb2"
    android:progressDrawable="@drawable/seekbar1"
    android:layout_height="fill_parent"
    android:clickable="false"
    android:focusable="false"

    android:longClickable="false"/>

I want to disable the manual motion of this seek bar. i mean the seek can only move by my code and it cannot be accessed by any other means (Touch).

like image 947
Labeeb Panampullan Avatar asked Oct 26 '10 05:10

Labeeb Panampullan


1 Answers

Just add touch event handler and return true, like example below:

    seekBar.setOnTouchListener(new OnTouchListener(){
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return true;
        }
    });

User won't be able to touch and change the progress this way.

like image 168
Muhammad Abdullah Avatar answered Sep 28 '22 06:09

Muhammad Abdullah