This time I will bring you several Click response methods for Button. What are the precautions for using Button's Click responsemethod? The following is a practical case, let's take a look.
Button is used a lot. I have sorted out its Implementation one:Button bt_Demo = (Button)findViewById(R.id.bt_Demo); bt_Demo.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //响应Clicked事件 //...... } });
Button bt_Demo = (Button)findViewById(R.id.bt_Demo); bt_Demo.setOnClickListener(listener); private OnClickListener listener = new OnClickListener(){ @Override public void onClick(View arg0) { // TODO Auto-generated method stub switch(arg0.getId()){ case R.id.bt_Demo: //响应Clicked事件 //...... break; default: break; } } }
Button bt_Demo = (Button)findViewById(R.id.bt_Demo); bt_Demo.setOnClickListener(new ButtonListener()); private class ButtonListener implements OnClickListener{ @Override public void onClick(View arg0) { //响应Clicked事件 //...... } }
How to make the html drop-down menu retain the selected value and not return to the default value after submission
How to html Example of adding attributes using style
#How to set focus on an html element
The above is the detailed content of Button has several Click response methods. For more information, please follow other related articles on the PHP Chinese website!