android alertdialog 自定义button监听事件

AlertDialog Dialog = new AlertDialog.Builder(Huntinfo.this).create(); 

Dialog.show(); 
Dialog.getWindow().setGravity(Gravity.BOTTOM); 
Dialog.getWindow().setLayout( 
android.view.WindowManager.LayoutParams.FILL_PARENT, 
android.view.WindowManager.LayoutParams.WRAP_CONTENT); 
Dialog.getWindow().setContentView(R.layout.buttom_alertdialog);


Button button0 = (Button) Dialog.getWindow().findViewById(R.id.button0); 
button0.setOnClickListener(new OnClickListener(){ 

@Override 
public void onClick(View v) { 
Log.v("点击","被点了");

});

这个顺序很重要?!

原文地址:https://www.cnblogs.com/Ringer/p/4032910.html