這似乎是一個非常簡單的問題,但由於某種原因,我發現自己找不到任何合適的答案。我所擁有的是2個按鈕,其中一個按鈕疊放在另一個框架佈局中,當點擊Button1時,它將變爲不可見,並出現Button2。我想要發生的事情是幾秒鐘後Button2自動變爲不可見,並且Button1再次可見。這是我有的一小部分代碼。任何幫助將不勝感激!Android按鈕設置按鈕不可見不點擊
button1 = (Button)findViewById(R.id.button1);
button2 = (Button)findViewById(R.id.button2);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
button1.setVisibility(Button.GONE);
button2.setVisibility(Button.VISIBLE);
}
});
http://stackoverflow.com/questions/1877417/how-to-set-a-timer-in-android – Simon