android自定义对话框

上一篇 / 下一篇  2013-09-03 20:54:52 / 个人分类:step by step android测试

                    //*******************************
/*                  Button button=(Button)findViewById(R.id.alert);
                    button.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {*/
                            new AlertDialog.Builder(TabmyActivity.this).setTitle("填写日期").setView(getLayoutInflater()
                                    .inflate(R.layout.dialog_alert,(ViewGroup)findViewById(R.id.dialog_my)))
                                    .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialogInterface, int i) {
                                            Toast.makeText(getApplicationContext(),"表明可以做其他操作哦",Toast.LENGTH_LONG).show();
                                        }
                                    })
                                    .setNegativeButton("取消", null).show();

/*                        }*/
/*                    });*/
                    //*******************************

R.layout.dialog_alert中描述了自定义对话框的布局,R.id.dialog_my为布局中定义的对话框的id

还有很多其他的对话框,大家想了解的话,可以访问http://www.cnblogs.com/salam/archive/2010/11/15/1877512.html

TAG:

 

评分:0

我来说两句

Open Toolbar