自定义dialog

public void showDialog() {
View view = getActivity().getLayoutInflater().inflate(
R.layout.mydialog, null);
dialog = new AlertDialog.Builder(getActivity()).setView(view).create();

btn_submit = (Button) view.findViewById(R.id.btn_submit);
btn_cancle = (Button) view.findViewById(R.id.btn_cancle);
et_time = (EditText) view.findViewById(R.id.et_time);
btn_submit.setOnClickListener(this);
btn_cancle.setOnClickListener(this);
dialog.show();
}

 

public void showDialog(){
dialog=new AlertDialog.Builder(getActivity()).create();
dialog.show();
Window window = dialog.getWindow();
window.setContentView(R.layout.mydialog);

btn_submit=(Button) window.findViewById(R.id.btn_submit);
btn_cancle=(Button) window.findViewById(R.id.btn_cancle);
et_time=(EditText) window.findViewById(R.id.et_time);
btn_submit.setOnClickListener(this);
btn_cancle.setOnClickListener(this);
}

posted @ 2016-01-08 08:44  请叫我码农怪蜀黍  阅读(96)  评论(0编辑  收藏  举报