In my Android app I have an AlertDialog with an EditText to input the name of the user. The AlertDialog contains a title and a message, and the EditText contains a hint. All are left aligned, which is good, but they are not aligned with each other.
Here is my current code for the AlertDialog:
final EditText nameText = new EditText(this);
nameText.setHint(dialogHint);
AlertDialog dialog = new AlertDialog.Builder(this)
   .setTitle(dialogTitle)
   .setMessage(dialogMessage)
   .setView(nameText)
   .setPositiveButton(textPositiveButton, new DialogInterface.OnClickListener() {
      @Override
      public void onClick(DialogInterface dialog, int which) {
         // Get name from player
         String highScoreName = String.valueOf(nameText.getText());
         // Do something with highScoreName
      }
   })
   .setNegativeButton(textNegativeButton, new DialogInterface.OnClickListener() {
      @Override
      public void onClick(DialogInterface dialog, int which) {
         // Do nothing
      }
   })
   .create();
dialog.show();
This is how it looks:
And this is how I want it to look:
Is there a way to achieve this? Searching for answers online only led me to questions about central aligning the AlertDialog message or aligning separate AlertDialog and EditText views. Any help is appreciated.


 
    