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

╄→尐↘猪︶ㄣ 提交于 2019-11-27 17:27:00

问题


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.


回答1:


mySeekBar.setEnabled(false);

or for XML:

android:enabled="false"




回答2:


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.



来源:https://stackoverflow.com/questions/4136569/how-to-set-an-android-seekbar-to-be-unmoveable-frozen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!