У меня есть панель поиска, которую я хочу исчезнуть при нажатии кнопки, и снова появиться после обратного отсчета. Я использовал seekBarTimeToPlay.setVisibility(view.INVISIBLE);
в методе onFinish()
после обратного отсчета.
Однако я получаю сообщение об ошибке «не удается разрешить символ« просмотр ».» А также "не может разрешить символ 'seekBarTimeToPlay'". но, кажется, решить эту проблему, добавив еще один SeekBar seekBarTimeToPlay = (SeekBar) findViewById(R.id.seekBarTimeToPlay);
внутри метода.
//change timeToPlay seekBar
SeekBar seekBarTimeToPlay = (SeekBar) findViewById(R.id.seekBarTimeToPlay);
//set progress/thumb pos to right place
seekBarTimeToPlay.setProgress(timeToPlay);
seekBarTimeToPlay.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
timeToPlay = progress;
updateTimeToPlay(timeToPlay, false);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
updateTimeToPlay(timeToPlay, true);
}
});
//start playing, countdown
final Button buttonMain = (Button) findViewById(R.id.buttonMain);
buttonMain.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//countdown, updating time to tidy text view, progress bar or clock animation
SeekBar seekBarTimeToPlay = (SeekBar) findViewById(R.id.seekBarTimeToPlay);
if (phase == "none") { //parent presses button, child starts playing
phase = "playing";
buttonMainText = "Pack Away Now";
//hide seekBar, doesn't change layout
seekBarTimeToPlay.setVisibility(View.INVISIBLE);
startCountDown(timeToPlay);
} else if (phase == "playing") {//parent presses button to pack away before time ended
phase = "tidying";
buttonMainText = "Confirm tidied up";
countDownTimer.cancel(); //maybe error if countdown isn't running, if statement might solve
updateTimeToPlay(timeToTidy, false);
startCountDown(timeToTidy); //new 10 minute countdown to wait for conformation that toys are away
//waiting to receive conformation, if received cancel countdown n that
} else if (phase == "tidying") { //parent presses button confirming packed away
countDownTimer.cancel(); //maybe error if countdown isn't running, if statement might solve
phaseWasTidying();
}
buttonMain.setText(buttonMainText); //change text to whatever stage
//returns here after button pressed
seekBarTimeToPlay.setVisibility(View.VISIBLE); //make visible again
}
});
}
Как изменить видимость с другого метода? Я также не могу использовать static
, чего я не понимаю.