我需要在点击开始按钮时停止移动的搜索栏。搜索栏必须显示在开始位置。
为此我试过, seekBar.setProgress(0)。但它对我不起作用。我已经发布了相关代码:
public void stopPlay(View view) {
try {
if(myPlayer.isPlaying()){
myPlayer.pause();
}
if (myPlayer != null) {
myPlayer.stop();
myPlayer.release();
myPlayer = null;
playBtn.setEnabled(true);
stopPlayBtn.setEnabled(false);
text.setText("Recording Point: Stop playing");
seekBar.setProgress(0);
Toast.makeText(getApplicationContext(),
"Stop playing the recording...", Toast.LENGTH_SHORT)
.show();
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
答案 0 :(得分:0)
试试这个
try {
runOnUiThread(new Runnable() {
@Override
public void run() {
seekBar.setProgress(0);
}
});
} catch (Exception e) {
e.printStackTrace();
}