android disable seek bar for audio controller

后端 未结 4 901
抹茶落季
抹茶落季 2021-02-05 14:37

I used the following seek bar for displacing the progress of my audio.



        
相关标签:
4条回答
  • 2021-02-05 14:55

    Try this

    seekBar.setEnabled(false);
    
    0 讨论(0)
  • 2021-02-05 15:01

    Just add touch event handler and return true, like example below:

        seekBar.setOnTouchListener(new OnTouchListener(){
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return true;
            }
        });
    

    User won't be able to touch and change the progress this way.

    0 讨论(0)
  • 2021-02-05 15:01

    Try adding a empty eventhandler for the event of "click".

    0 讨论(0)
  • 2021-02-05 15:15

    Kotlin lambda solution:

    seekbar.setOnTouchListener { _, _ -> true }
    
    0 讨论(0)
提交回复
热议问题