问题
I used the following seek bar for displacing the progress of my audio.
<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"/>
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).
回答1:
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.
回答2:
Try adding a empty eventhandler for the event of "click".
回答3:
Try this
seekBar.setEnabled(false);
来源:https://stackoverflow.com/questions/4020881/android-disable-seek-bar-for-audio-controller