我有一個按鈕,當我按下它時,我想刪除它(不會使它不可見)。我讀到,我可以使用layout.removeView(mybutton)
來做到這一點,但是佈局是什麼?我怎樣才能得到它在我的活動Android動態刪除按鈕
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;
}
}
佈局是視圖父母你按鈕。 – 2012-06-23 12:07:09