java 警报对话框

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java 警报对话框相关的知识,希望对你有一定的参考价值。

  Context context = GenerateListActivity.this;
                    LinearLayout layout = new LinearLayout(context);
                    layout.setOrientation(LinearLayout.VERTICAL);

                    final EditText item = new EditText(GenerateListActivity.this);
                    item.setHint("Item");
                    item.setInputType(InputType.TYPE_CLASS_TEXT);
                    layout.addView(item);

                    final EditText price = new EditText(GenerateListActivity.this);
                    price.setHint("Price");
                    price.setInputType(InputType.TYPE_CLASS_NUMBER);
                    layout.addView(price);

                    final EditText quantity = new EditText(GenerateListActivity.this);
                    quantity.setHint("Quantity");
                    quantity.setInputType(InputType.TYPE_CLASS_NUMBER);
                    layout.addView(quantity);

                    AlertDialog.Builder popUpMessage = new AlertDialog.Builder(GenerateListActivity.this);
                    popUpMessage.setMessage("Click on an item to edit the price and quantity")
                            .setTitle("Information")
                            .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int id) {

                                }
                            });
                    popUpMessage.setIcon(R.drawable.appicon);
                    popUpMessage.setView(layout);
                    popUpMessage.create();
                    popUpMessage.show();
  AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setMessage("TEst")
                    .setTitle("title here")
                    .setPositiveButton("ok", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            // CONFIRM
                        }
                    })
                    .setNegativeButton("cancel", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            // CANCEL
                        }
                    });
            // Create the AlertDialog object and return it
            builder.create();
            builder.show();

以上是关于java 警报对话框的主要内容,如果未能解决你的问题,请参考以下文章

java 自定义警报对话框

java 警报对话框

java 显示输入警报对话框

java 警报对话框(标题,内容,2个按钮)

java 警报对话实施

java 显示软键盘警报对话框。字体:https://stackoverflow.com/questions/12997273/alertdialog-with-edittext-open-soft-