定义AlertDialog子类


public class AddStockFormDialog extends AlertDialog {



public AddStockFormDialog(Context context) {
super(context);
setTitle("dsfaa");
setView(getLayoutInflater().inflate(R.layout.add_stock_form, null));

//添加button,第一个参数为button类型,可以是确认或取消键
        setButton(BUTTON_POSITIVE, "dsfasf", new OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub

}
});
// TODO Auto-generated constructor stub
}

}

你可能感兴趣的:(定义AlertDialog子类)