Android 底部Dialog显示

时间:2022-11-01 11:09:21
  public void showComplainDialog() {
        ComplainDialog complain_dialog = new ComplainDialog(OrderDetialActivity.this,
                R.style.customdialog_complain_style,
                R.layout.complain_dialog);
        Window win = complain_dialog.getWindow();
        win.getDecorView().setPadding(0, 0, 0, 0);
        WindowManager.LayoutParams lp = win.getAttributes();
        lp.width = WindowManager.LayoutParams.FILL_PARENT;
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        win.setAttributes(lp);
        complain_dialog.show();
        complain_dialog
                .setYourListener(new ComplainDialog.ComplainButtonListener() {
                    @Override
                    public void setComplainString(String complainString) {
                        if (IsChinese.iszhongwen(complainString)) {
                            showTipsDialog("投诉输入含有非法字符");
                            return;
                        }
                        if (IsChinese.containsEmoji(complainString)) {
                            showTipsDialog("不支持输入表情符号");
                            return;
                        }
                        if (!TextUtils.isEmpty(complainString)) {
                            setComplainInfo(complainString.replace(" ", "").replace("\n", ""));
                        }
                    }
                });
    }