Setting Margins for EditText in AlertDialog
<p>I've created an AlertDialog with an EditText in my Android app, but the default margins look really off.  I've tried to specify margins as follows:</p>

<pre><code>  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);
</code></pre>

<p>However, from the image below, you can see that it is not applying the desired effect.</p>

<p><a href="https://i.stack.imgur.com/lkGnp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lkGnp.png" alt="enter image description here"></a></p>

<p>Other options I've tried including placing the input in a LinearLayout and setting the margins using LayoutParams before setting the AlertDialog view to the LinearLayout.</p>

<p><strong>How do I set the margins for an EditText in an AlertDialog?</strong></p>