AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("自定义对话框");
builder.setPositiveButton("确定",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
});
LayoutInflater inflater = LayoutInflater.from(this);// 渲染器
View view = inflater.inflate(R.layout.opinionsdialog, null);
TextView tv1 = (TextView) view.findViewById(R.id.tv_dialog_12);
TextView tv2 = (TextView) view.findViewById(R.id.tv_dialog_22);
tv1.setText("测试数据1");
tv2.setText("测试数据2");
builder.setView(view);
opinionsDialog = builder.create();
opinionsDialog.show();