1

I need to change the color of the edit text line, in the alert dialog, I'm trying everything, and I'm not working.

public void alertaComentario()
    {
        AlertDialog.Builder comentario = new AlertDialog.Builder(getActivity(), R.style.AppCompatAlertDialogStyle);
        comentario.setMessage("Escreva uma resenha curta");
        final EditText input = new EditText(getActivity());
        input.setInputType(InputType.TYPE_CLASS_TEXT);
        comentario.setView(input);

        comentario.setPositiveButton("Enviar", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Toast.makeText(getActivity(), "A sociedade agradece seu comentário", Toast.LENGTH_SHORT).show();
            }
        });
        comentario.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();
            }
        });
        comentario.show();
    }

alert dialog

enter image description here

Navneet Krishna
  • 5,009
  • 5
  • 25
  • 44

2 Answers2

1

The line in an editText is usually based on the ColorAccent in the colors.xml:

<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color> //Change this

If you change the color accent, it will change editText color.

0

in your Alert Dialog xml update EditText with this line:

 android:backgroundTint="#ffffff"
Tara
  • 692
  • 5
  • 23