//获取布局的管理对象
LayoutInflater inflater = getLayoutInflater();
//添加自定义的布局到view View view1 = inflater.inflate(R.layout.
dialog_activity,
null);
//显示AlertDialog并把自定义的布局添加到AlertDialog AlertDialog dialog = new AlertDialog.Builder(this).setView(view1).show();