我使用以下搜索栏来取代我的音频进度。
<SeekBar
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"/>
我想禁用此搜索栏的手动运动。我的意思是搜索只能通过我的代码移动,不能通过任何其他方式访问(触摸)。
最佳答案
只需添加触摸事件处理程序并返回 true,如下例所示:
seekBar.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
用户将无法通过这种方式触摸和更改进度。
关于android禁用音频 Controller 的搜索栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4020881/