很好,我的代码..在我的材料对话框中添加两个输入并拥有此image
MaterialDialog dialog = new MaterialDialog.Builder(this)
.title(R.string.ingresar_codigo)
.inputType(InputType.TYPE_CLASS_TEXT)
.input(getString(R.string.codigo), "1", new MaterialDialog.InputCallback() {
@Override
public void onInput(@NonNull MaterialDialog dialog, CharSequence input) {
datos[0] = input.toString();
Log.d(TAG, datos[0]);
}
})
.inputType(InputType.TYPE_CLASS_TEXT)
.input(getString(R.string.dni), "2", new MaterialDialog.InputCallback() {
@Override
public void onInput(@NonNull MaterialDialog dialog, CharSequence input) {
datos[1] = input.toString();
Log.d(TAG, datos[1]);
}
})
.positiveText(R.string.aceptar)
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
if (!datos[0].isEmpty() && !datos[1].isEmpty()) {
confirmarDialogoDatos(datos[0], datos[1], MenuCorporativo.this);
} else { Snackbar.make(layout, "DEBE INGRESAR DATOS", Snackbar.LENGTH_LONG).show(); }
}
})
.negativeText(R.string.cancelar)
.onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
dialog.dismiss();
}
})
.show();
我遇到的问题不是在我的素材对话框中有两个EditText
答案 0 :(得分:1)
您可以将自定义布局与2个EditText一起使用
boolean wrapInScrollView = true;
new MaterialDialog.Builder(this)
.title(R.string.title)
.customView(R.layout.custom_view, wrapInScrollView)
.positiveText(R.string.positive)
.show();
MaterialDialog dialog = //... initialization via the builder ...
View view = dialog.getCustomView();
view.findViewById(R.id.edittext1)
view.findViewById(R.id.edittext2)