Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 27, 2019 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/37dc865437549f2a327f2ddbece1f323 to your computer and use it in GitHub Desktop.
Save parzibyte/37dc865437549f2a327f2ddbece1f323 to your computer and use it in GitHub Desktop.
LinearLayout layout = new LinearLayout(MainActivity.this);
layout.setOrientation(LinearLayout.VERTICAL);
final EditText editTextNombre = new EditText(MainActivity.this);
editTextNombre.setHint("Nombre");
layout.addView(editTextNombre);
final EditText editTextPass = new EditText(MainActivity.this);
editTextPass.setInputType(EditorInfo.TYPE_TEXT_VARIATION_PASSWORD);
editTextPass.setHint("Contraseña");
layout.addView(editTextPass);
final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder
.setTitle("El título")
.setNegativeButton("Cancelar", null)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(MainActivity.this, "Click en ok", Toast.LENGTH_LONG).show();
}
});
final AlertDialog alertDialogPersonalizado = builder.create();
alertDialogPersonalizado.setView(layout);
// después mostrarla:
alertDialogPersonalizado.show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment