自定义对话确定框
private void confirmInfo() {
// 创建对话框构建器
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(false);
// 获取布局
View view2 = View.inflate(this, R.layout.activity_inventory_info, null);
// 获取布局中的控件
TextView tv_operateInfo = (TextView)view2.findViewById(R.id.tv_operateInfo);
TextView tv_operateType = (TextView)view2.findViewById(R.id.tv_operateType);
tv_operateInfo.setText("确定要提交下单操作?");
tv_operateType.setText("下单量");
TextView tv_submit = (TextView)view2.findViewById(R.id.tv_submit);
TextView tv_cancel = (TextView)view2.findViewById(R.id.tv_cancel);
// 设置参数
builder.setView(view2);
// 创建对话框
final AlertDialog alertDialog = builder.create();
tv_submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
alertDialog.dismiss();
}
});
tv_cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
alertDialog.dismiss();
}
});
alertDialog.show();
}