我檢查了所有的方法,沒有奏效! 我想檢查一下Button
是否被點擊設置文字爲「好」,否則 設置文字爲「跳轉」。如何檢查按鈕是否已經點擊運行這個呢?
這是可能的嗎? Button
將文字「跳轉」,點擊時設置爲「好」 否則將文本重置爲原始而不再使用setText
?
public void onClick(View arg0) {
// TODO Auto-generated method stub
if(b.isSelected()){
b.setText("Good");
}
else
b.setText("Jump");
}
});
哪種類型有你的按鈕b? – nnesterov
其按鈕b =(按鈕)findViewById(R.Id.button2); – theRadBrad
首先讓你的Button的ID如下 Button btn =(Button)findViewById(R.id.button1); btn.setText(「Jump」); 然後點擊收聽 btn.setOnClickListener(新OnClickListener() 集合{ btn.setText( 「好」);} 爲什麼 –