【发布时间】:2011-04-25 03:27:38
【问题描述】:
我想在第二次点击时禁用按钮按下,所以我在我的 android 代码中有此按钮的操作处理程序代码:
// do something when the button is clicked
public void onClick(View v) {
final Button button = (Button)findViewById(R.id.radio_red);
if(button.isPressed()==true && rt1==true )
{
button.setPressed(false);
button.clearFocus();
//rt1=false;
//do some processing !
}
else rt1=true;
}'
但是,button.setPressed(false);没有按预期工作。 :(
谁能帮帮我?
【问题讨论】:
-
你对 button.setPressed(false) 有什么期望,你会得到什么?
-
我希望这一行将按钮的按下状态设置为 false。我现在不明白。如果我按三次按钮,这个处理程序不应该进入第一个循环,对吗?在第二次按下按钮时,用户界面应该将按钮播种为未按下,对吗?这不是在这里发生的:(
标签: java android user-interface button