How to Set an Android SeekBar to be unmoveable/fro

2020-02-10 01:24发布

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.

2条回答
太酷不给撩
2楼-- · 2020-02-10 01:41

mySeekBar.setEnabled(false);

or for XML:

android:enabled="false"

查看更多
【Aperson】
3楼-- · 2020-02-10 01:45

You could create a subclass whose parent is a SeekBar. In your new class, override the onTouchEvent() method to always return false.

This solution should not "grey out" the seek bar since the enabled state will not change.

查看更多
登录 后发表回答