Unclickable Seekbar in android listview

I have a Listview in my application. Listview rows can be clicked. I entered a search string in each line of the list. Despite the android: clickable = "false" settings for Seekbar in the xml layout, I can still click on it and move the search bar as desired. I don't want the Seekbar to be a click, but I need the Listview row to be clicked.

Any pointers would be appreciated.

Here is 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"
+5
source share
3 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);
            }               
        }
    });
+10
source

Add focusable = false to the search bar.

0
source

Try setting the enabled attribute to false. You may need to manually adjust the color if you want to avoid "greyed out"

eg.

seekBar.setEnabled(false);

Now I got this working, using both setFocusable and setEnabled for false, I implemented a solution to enable the search bar for one setting when the list item is clicked too if you are interested.

0
source

All Articles