Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unclickable Seekbar in android listview

Tags:

android

I have a Listview in my application. Listview rows are clickable. I have introduced a seek bar in each row of a Listview. Despite settings android:clickable="false" for Seekbar in layout xml, I am still able to click on it and move seek bar as desired. I don't want Seekbar to be clickbale but I do want Listview row to clickable.

Any pointers will be appreciated.

Here's my layout file

android:progressDrawable="@drawable/slider_range"
        android:thumb="@drawable/slider_thumb"
        android:layout_width="80dip"
        android:layout_height="12dip"
        android:focusable="false"
        android:clickable="false"
        android:longClickable="false"
like image 807
cppdev Avatar asked May 22 '10 08:05

cppdev


1 Answers

seekBarObj.setOnSeekBarChangeListener( new OnSeekBarChangeListener() {

        int originalProgress;

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            //Nothing here..                
        }

        @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);
            }               
        }
    });
like image 100
jaxvy Avatar answered Oct 14 '22 09:10

jaxvy