选择所有正确答案后禁用按钮

时间:2018-02-11 03:27:07

标签: java android

我已经想出如何在我的previous post中选择所有可能的正确答案,问题是问题只会通过选择错误的答案进入下一轮,然后出现下一个按钮。< / p>

已选择所有正确答案。

All correct answers have been selected.

只有在选择了错误答案时才会出现下一个按钮。

Next button would only appear when a wrong answer is selected.

我修改了我之前发布的问题的代码:

public void answerButtonClickHandler(View v)
{
    Answer answer = answers.get(v.getId());
    if (answer != null) {
        questionAnswered++;
        if (answer.isCorrect()) {
            correctlyAnswered++;
            v.setBackgroundResource(R.drawable.answer_button_correct);
        } else{
            disableAnswerButtons();
            v.setBackgroundResource(R.drawable.answer_button_wrong);
            questionDescriptionText.setText(question.getDescription());
            questionDescriptionText.setVisibility(View.VISIBLE);
            nextBtn.setVisibility(View.VISIBLE);
        }



        if (nextQuestionIndex >= questionsIndexList.size()) {

        //} else{
            completeBtn.setVisibility(View.VISIBLE);
        }

    }
}

0 个答案:

没有答案