Código:
AlertDialog.Builder login = new AlertDialog.Builder(activity); address.setTitle("Identificate"); LinearLayout layout = new LinearLayout(activity); layout.setOrientation(LinearLayout.VERTICAL); layout.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); LinearLayout linea1 = new LinearLayout(activity); linea1.setOrientation(LinearLayout.HORIZONTAL); linea1.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); final TextView Usuario = new TextView(activity); Usuario.setText("Usuario"); linea1.addView(Usuario); final EditText usuario = new EditText(activity); linea1.addView(usuario); layout.addView(linea1); // Set an EditText view to get user input LinearLayout linea2 = new LinearLayout(activity); linea2.setOrientation(LinearLayout.HORIZONTAL); linea2.setLayoutParams(new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); final TextView Password = new TextView(activity); Password.setText("Contraseña"); linea2.addView(Password); final EditText password = new EditText(activity); linea2.addView(password); layout.addView(linea2); login.setView(layout);
Gracias!