@OnClick(R.id.input_custominvalidation) public void showInputDialogCustomInvalidation() {
new MaterialDialog.Builder(this)
.title(R.string.input)
.content(R.string.input_content_custominvalidation)
.inputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_VARIATION_PERSON_NAME |
InputType.TYPE_TEXT_FLAG_CAP_WORDS)
.positiveText(R.string.submit)
.alwaysCallInputCallback() // this forces the callback to be invoked with every input change
.input(R.string.input_hint, 0, false, (dialog, input) -> {
if (input.toString().equalsIgnoreCase("hello")) {
dialog.setContent("I told you not to type that!");
dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
} else {
dialog.setContent(R.string.input_content_custominvalidation);
dialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
}
}).show();
}
MainActivity.java 文件源码
java
阅读 19
收藏 0
点赞 0
评论 0
项目:GitHub
作者:
评论列表
文章目录