I want to show alertBox for user input. So I added EditText View to alertBox. code of my alertBox:
final EditText input = new EditText(this);
input.setX(10);
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(this);
builder.setMessage("Title")
.setCancelable(false)
.setView(input)
.setTitle("Create new Playlist")
.setPositiveButton("CREATE",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
playlistName = input.getText().toString();
dialog.cancel();
}
})
.setNegativeButton("CANCEL",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
android.app.AlertDialog alert = builder.create();
alert.show();
This gives the following alert dialog:

But EditText does not start from where the Header and Message header starts (indentation is not correct). Therefore, I want the next type of EditText to have the correct indentation in the alert dialog.

How to do it? How to change the position of views in the notification dialog? Or how to resize a view?
user6649667
source
share