Search code examples
androidfocusclicktouchseekbar

How to Set an Android SeekBar to be unmoveable/frozen?


In my XML, I've set the focusable, focusableInTouchMode, clickable, and longClickable variables to false, yet I can still click and move the SeekBar. Do I need to actually change the listener events to do this? That seems so unnecessary.


Solution

  • You need to do this from your activity or fragment by

    //java
    mySeekBar.setEnabled(false);
    
    //kotlin
    mySeekBar.enabled = false;
    

    Or if you want to do it by xml

    android:enabled="false"