title: Dialog fills screen size. I can't make it be a fixed size
body: <p>I'm trying to make a popup with a Dialog with a fixed height, but I can't manage to get it working.</p>
  
  <p>This is my code to build the dialog:</p>
  
  <pre><code>Builder dialogBuilder = new AlertDialog.Builder(this);
  ScrollView scvUsersToInvite = (ScrollView) this.mInflater.inflate(R.layout.dialog_users_to_invite, null);
  LinearLayout usersToInvite = (LinearLayout) scvUsersToInvite.findViewById(R.id.containerUsersToInvite);
  //I add several layouts to the container.
  for (int i=0; i&lt;25;i++){
      RelativeLayout usuariPerInvitar = (RelativeLayout)this.mInflater.inflate(R.layout.entrada_user_invitar, usersToInvite, false);
      TextView tvNomUser = (TextView)usuariPerInvitar.findViewById(R.id.textView1);
      tvNomUser.setText("TextView number "+i);
      usersToInvite.addView(usuariPerInvitar);
  }
  
  dialogBuilder.setView(scvUsersToInvite);
  </code></pre>
  
  <p>This is working correctly, its filling the layout with 25 times the layout <code>entrada_user_invitar</code></p>
  
  <p>So those are the XML layouts:</p>
  
  <p><code>dialog_users_to_invite.xml</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/scrollView1"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content" &gt;
  
  &lt;LinearLayout
      android:id="@+id/containerUsersToInvite"
      android:layout_width="wrap_content"
      android:layout_height="50dp"
      android:orientation="vertical" 
      android:layout_marginRight="10dp"
      android:layout_marginLeft="15dp"&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>As you can see, height is set to 50dp, but anyways nothing happens.</p>
  
  <p>This is what I inflate several times:</p>
  
  <p><code>entrada_users_invitar.xml</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content" &gt;
  
  &lt;CheckBox
      android:id="@+id/checkBox1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentRight="true"
      android:layout_alignParentTop="true" /&gt;
  
  &lt;TextView
      android:id="@+id/textView1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentLeft="true"
      android:layout_alignParentTop="true"
      android:layout_marginTop="5dp"
      android:text="TextView" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>As you can see in the picture, obviously the dialog is not 50dp height...
  <img src="https://i.stack.imgur.com/pgCzw.png" alt="enter image description here"></p>
  
  <p>How should I write the XML layout to limit the height?</p>