0
this에 미디어 플레이어 예제를 사용하여 탐색 서랍을 만들고 재생/일시 중지 버튼을 표시했습니다. 내가 그 일을 가지고있어, 하나의 문제가 생겼어. 예를 들어, 재생 버튼을 클릭하면 notif로드가 표시되고로드 한 후 notif가 재생되도록 업데이트 한 다음 재생 버튼이 일시 중지 버튼으로 바뀐다. 미디어 플레이어가 재생 중일 때 멈춤을 보여 주어야하는 것처럼 보이도록 버튼의 상태를 표시하려면 서비스 버튼을 클릭하십시오. 대신 재생 버튼이 표시됩니다.미디어 플레이어의 재생/일시 중지 버튼
도움을 주시면 감사하겠습니다.
감사
편집 : 재생/일시 정지 코드 : 나는 알림을 클릭 가정 해 봅시다
public void onClick(View target) {
// Send the correct intent to the MusicService, according to the button that was clicked
switch (target.getId()) {
case R.id.play_button:
startService(new Intent(MusicService.ACTION_PLAY));
mPlayButton.setVisibility(ImageButton.GONE);
mPauseButton.setVisibility(ImageButton.VISIBLE);
break;
case R.id.pause_button:
startService(new Intent(MusicService.ACTION_PAUSE));
// pause music here
mPauseButton.setVisibility(ImageButton.GONE);
mPlayButton.setVisibility(ImageButton.VISIBLE);
break;
}
재생/일시 중지 버튼을 업데이트하는 코드를 알려주십시오. – 0xF
안녕하세요, 업데이트 용 재생/일시 중지 코드로 제 질문을 업데이트했습니다. – user1782426