安卓禁用搜索栏音频CONTROLER音频、CONTROLER

2023-09-05 03:52:39 作者:迷鹿了i

我用下面的搜索栏用于移动我的音乐的进展。

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

android:padding="7dp"

android:id="@+id/SeekBar01"

android:layout_width="245dip"

android:thumb="@drawable/seekthumb2"

android:progressDrawable="@drawable/seekbar1"

android:layout_height="fill_parent"

android:clickable="false"

android:focusable="false"


android:longClickable="false"


/>

我想禁用这个搜索栏的手动运动。我指的是寻求只能通过我的code移动,它不能以任何其他方式(触摸)进行访问。 谢谢

I want to disable the manual motion of this seek bar. i mean the seek can only move by my code and it cannot be accessed by any other means (Touch). Thank you

推荐答案

只需添加触摸事件处理程序,并返回true,就像下面的例子:

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.