Search code examples
androidcustom-controlsseekbar

Disable changes on seekbar by client


I have a SeekBar that will change the progress when I require it to, but I don't want the user to be able to change it manually.

I tried to set the SeekBar as this:

<SeekBar
        android:id="@+id/seekBar1"
        android:layout_width="match_parent"
        android:layout_height="65dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="78dp"
        android:progress="10"
        android:max="100"
        android:clickable="false"
        android:thumb="@drawable/transparent"
        android:progressDrawable="@drawable/customprogressbar" />

But it doesn't work.

How can I do this?


That's more or less an example of how this is going to be seen by the client.

I used a custom style because in the future I'll need to change the background images and the progress depending on which section the SeekBar will be.

Thanks for all!

No given description by asker


Solution

  • One thing you can do is to disable the seekbar, Like seekbar.setEnabled(false)

    doing so framework will not accept any Touch event from user and you Can change progress level only through code.

    I hope this will help you.......