title: Custom dialog opens full screen
body: <p>I'm developing an Android application and I have a question about custom dialogs.</p>
  
  <p>I do this to open a custom dialog:</p>
  
  <pre><code>protected void showSetFriendEmailDialog()
  {
      // Create the dialog.
      final Dialog emailDialog = 
              new Dialog(FriendHomeActivity.this, android.R.style.Theme_DeviceDefault);
      emailDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
  
      emailDialog.setCancelable(true);
      emailDialog.setContentView(R.layout.dialog_add_friend_email);
  
      // Get dialog widgets references.
      final EditText editFriendsEmail = (EditText)emailDialog.findViewById(R.id.editEmailAddFriendEmail);
      Button btnAccept = (Button)emailDialog.findViewById(R.id.btnAddFriendEmail);
  
      // Set on click lister for accept button
      btnAccept.setOnClickListener(new View.OnClickListener()
      {
          @Override
          public void onClick(View view)
          {
              // Get selected values
              String friendEmail = 
                      editFriendsEmail.getText().toString();
  
              // Close dialog.
              emailDialog.dismiss();
  
              // TODO: Call api to send email to web service using friendsEmail var.
              Log.v(TAG, "Friend email: " + friendEmail);
          }
      });
  
      //now that the dialog is set up, it's time to show it    
      emailDialog.show();
  }
  </code></pre>
  
  <p>And this is its layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;TextView
          android:id="@+id/textAddFriendEmail"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/layout_set_friend_email"
          android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
  
      &lt;EditText
          android:id="@+id/editEmailAddFriendEmail"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:ems="10"
          android:inputType="textEmailAddress" &gt;
  
          &lt;requestFocus /&gt;
      &lt;/EditText&gt;
  
      &lt;Button
          android:id="@+id/btnAddFriendEmail"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/ok" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>But it opens full screen.</p>
  
  <p><strong>What do I have to do to open it as an <code>AlertDialog</code>?</strong></p>