例如:如何为他们同时绑定同一个监听器
        this.buttonMC=(Button)findViewById(R.button.bMC);
     this.buttonMR=(Button)findViewById(R.button.bMR);
     this.buttonMAdd=(Button)findViewById(R.button.bMADD);
     this.buttonMCut=(Button)findViewById(R.button.bMCUT);
     this.buttonDelete=(Button)findViewById(R.button.bDelete);
   
 class onClickListenrGather implements OnClickListener{ @Override
public void onClick(View v) {


}}  
    

解决方案 »

  1.   

    我怀疑这个能不能做到..  我个人认为做不到  即便是监听的方法都一样
    应该跟android的架构有关
      

  2.   

    让你的activity实现View.onClickListener接口,在onClick方法中可以通过button的id对各个button进行单独控制,当然,你也可以不区分button
      

  3.   

    view 有获得各个组件的名字或id的方法。用这个区分就好了。比如说
    if(view.getName() == "xxx")
    {
        执行操作
    }
      

  4.   

    package com.kang.zhaoping;import android.app.Activity;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;public class TestActivity extends Activity implements OnClickListener {
    private Button button = null;
    private Button button2 = null;
    private Button button3 = null;
    private Button button4 = null; private void initView() {
    this.button = (Button) findViewById(R.id.about);
    this.button2 = (Button) findViewById(R.id.addr);
    this.button3 = (Button) findViewById(R.id.addr_button);
    this.button4 = (Button) findViewById(R.id.company);
    this.button.setOnClickListener(this);
    this.button2.setOnClickListener(this);
    this.button3.setOnClickListener(this);
    this.button4.setOnClickListener(this);
    } @Override
    public void onClick(View view) {
    if (view == button) {
    System.out.println(button.getText());
    } else if (view == button2) {
    System.out.println(button2.getText());
    } else if (view == button3) {
    System.out.println(button3.getText());
    } else if (view == button4) {
    System.out.println(button4.getText());
    }
    }}
    是不是你想要的  你看看!!!!!