Tôi có một nút và khi tôi nhấn nút, tôi muốn xóa nút đó (không làm cho nút ẩn). Tôi đọc rằng tôi có thể làm điều đó bằng cách sử dụng layout.removeView(mybutton)
nhưng bố cục là gì? và làm thế nào tôi có thể nhận được nó trong hoạt động của tôiNút xóa Android động
Button showQuestion;
private void initialize() {
showQuestion = (Button) findViewById(R.id.bAnswerQuestionShowQuestion);
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.bAnswerQuestionShowQuestion:
showQuestion.setVisibility(View.INVISIBLE);
//Here i want to delete the button
question.setVisibility(View.VISIBLE);
theAnswer.setVisibility(View.VISIBLE);
answerQuestion.setVisibility(View.VISIBLE);
showChoices.setVisibility(View.VISIBLE);
showHint.setVisibility(View.VISIBLE);
break;
}
}
Bố cục là nút Xem bố mẹ bạn. –