AlertDialog弹出对话框(奶瓶)

一,简单的使用方法

AlertDialog.Builder aDlog = new        AlertDialog.Builder(cloudListActivity.this,AlertDialog.THEME_HOLO_LIGHT);
                    aDlog.setTitle("标题");
                    aDlog.setIcon(R.drawable.app_icon);
                    aDlog.setMessage("内容内容内容内容内容内容内容内容");
                    aDlog.setPositiveButton("确认",new DialogInterface.OnClickListener() {
                        
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            // TODO Auto-generated method stub
                            
                            
                        }
                    });
                    aDlog.setNegativeButton("取消", new DialogInterface.OnClickListener()
                        {
                            public void onClick(DialogInterface dialog, int which)
                            {
                          
                            }
                        });

                //展示
                    aDlog.show();
            }

拓展:

传统主题:

AlertDialog.Builder builder = new     AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_TRADITIONAL)

深黑色主题:

AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_HOLO_DARK);

蓝色主题:

AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_HOLO_LIGHT);

深色主题:

AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_DEVICE_DEFAULT_DARK);

浅蓝主题:

AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);

系统自带的不满意的话,还可以自定义style

    

你可能感兴趣的:(AlertDialog弹出对话框(奶瓶))