in my ap开发者_Python百科p i have three buttons namely A,B and C. I want the buttons B and C to be disabled until button A is clicked. they should be ready to perform this function until button A is clicked how to do this.....
protected void onCreate(Bundle savedInstanceState)
{
    buttonB.setEnabled(false);
    buttonC.setEnabled(false);
}
public void onClick(View v)
{
    if (v == buttonA)
    {
        buttonB.setEnabled(true);
        buttonC.setEnabled(true);
    }
}
you should write this will creating your app
myButton.setEnabled(false);
and in the button click function you should enable it by doing this.
myButton.setEnabled(true);
// assuming valid references to buttons
buttonB.setEnabled(false);
buttonC.setEnabled(false);
buttonA.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
    buttonB.setEnabled(true);
    buttonC.setEnabled(true);
}
});
Disable the button
myButton.setEnabled(false);
Enable the button
myButton.setEnabled(true);
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论