I created an AlertDialog with EditText in my Android app, but the default fields look really off. I tried to specify the fields as follows:
android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(SpinActivity.this); builder.setTitle("Edit Spin Tags"); builder.setMessage("(separate tags with commas)"); // set input int margin = 10; final EditText input = new EditText(SpinActivity.this); input.setSingleLine(); input.setText(spinTags.toString().replace("[", "").replace("]", "")); builder.setView(input, margin, 0, margin, 0);
However, from the image below, you can see that it does not apply the desired effect.

Other parameters I tried, including placing input in LinearLayout and setting fields using LayoutParams, before setting the AlertDialog view to LinearLayout.
How to set fields for EditText in AlertDialog?
android alertdialog
scientiffic
source share