看看,怎么给里面的四个按钮带代码哪儿添加监听器,谢谢
public class Alert01 extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        LayoutInflater factory = LayoutInflater.from(Alert01.this);
//得到自定义对话框
        final View DialogView = factory.inflate(R.layout.dialog01, null);
        
        AlertDialog dialog = new AlertDialog.Builder(Alert01.this)
        .setTitle("请选择操作")
        .setView(DialogView)
        .setPositiveButton("确定", 
        new DialogInterface.OnClickListener() {
        
public void onClick(DialogInterface dialog, int which) {
;
}
}).setNeutralButton("退出", null).create();
        dialog.show();
        
    }
}

解决方案 »

  1.   

    new DialogInterface.OnClickListener() {
                
                public void onClick(DialogInterface dialog, int which) {
                    ;
                }
    不是已经添加了吗?
      

  2.   

    这个是下面的确定按钮。的监听器。
    我说的是.setView(DialogView)这个DialogView里面的按钮。。谢谢
      

  3.   

    根据id得到DialogView 里面的button,然后再设置监听
      

  4.   


    Button button = (Button)DialogView.findViewById("R.id.button");
    button.setOnclickListener(this);写在你声明了DialogView之后就可以了
      

  5.   


    Button button = (Button)DialogView.findViewById(R.id.button);
    button.setOnclickListener(this);刚打多两个引号了,呵呵
      

  6.   


    为什么不行啊。 你要写在final View DialogView = factory.inflate(R.layout.dialog01, null);
    之后