title: Dialogfragment positioning
body: <p>Having a problem with positioning dialogfragment in Android 4.1, on other versions of Android OS everything is okay, problem appears only in 4.1.
  So what I'm trying to do is position fragment in bottom of the screen, but in Android 4.1 it looks like this with such whitespace:
  <img src="https://i.stack.imgur.com/4KTUa.png" alt="White space at bottom of the screen"></p>
  
  <p>And my code:</p>
  
  <pre><code>public class ContactsDialog extends DialogFragment {
  
  String contactNumber = null;
  String skypeContact = null;
  String userID = null;
  int flatsCount = 0;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
      TextView contactTV, skypeTV;
  
      View layout = inflater.inflate(R.layout.contacts_dialog, container);
  
      contactTV = (TextView) layout.findViewById(R.id.contactNumber);
      skypeTV = (TextView) layout.findViewById(R.id.skypeName);
      RelativeLayout skypeContactsLayout = (RelativeLayout) layout.findViewById(R.id.skypeContactsLayout);
      RelativeLayout contactsLayout = (RelativeLayout) layout.findViewById(R.id.contactsLayout);
      RelativeLayout allUserFlats = (RelativeLayout) layout.findViewById(R.id.allUserFlats);
  
      contactNumber = getArguments().getString("contactNumber", null);
      skypeContact = getArguments().getString("skypeName", null);
      userID = getArguments().getString("userID", null);
      flatsCount = getArguments().getInt("flatsCount");
  
      if(TextUtils.isEmpty(skypeContact)) {
          skypeContactsLayout.setVisibility(View.GONE);
      }
      if (TextUtils.isEmpty(userID)) {
          allUserFlats.setVisibility(View.GONE);
      }
      if (flatsCount == 1) {
          allUserFlats.setVisibility(View.GONE);
      }
  
      String convertedNumber = convertNumber(contactNumber);
  
      contactTV.setText(convertedNumber);
      skypeTV.setText(skypeContact);
  
      WindowManager.LayoutParams params = getDialog().getWindow()
              .getAttributes();
      params.gravity = Gravity.BOTTOM | Gravity.CENTER;
      getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
      getDialog().getWindow().setAttributes(params);
  
      contactsLayout.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent intent = new Intent(Intent.ACTION_CALL);
              intent.setData(Uri.parse("tel:" + contactNumber));
              startActivity(intent);
          }
      });
  
      allUserFlats.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent intent = new Intent(getActivity(), MainActivity.class);
              intent.putExtra("userID", userID);
              getActivity().finish();
              startActivity(intent);
          }
      });
      skypeContactsLayout.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
  
              if(isSkypeClientInstalled(getActivity())){
                  Intent sky = new Intent("android.intent.action.VIEW");
                  sky.setData(Uri.parse("skype:" + skypeContact));
                  startActivity(sky);
              } else {
                  Toast.makeText(getActivity(), "Skype не установлен", Toast.LENGTH_LONG).show();
              }
  
  
          }
      });
  
      return layout;
  }
  
  public boolean isSkypeClientInstalled(Context myContext) {
      PackageManager myPackageMgr = myContext.getPackageManager();
      try {
          myPackageMgr.getPackageInfo("com.skype.raider", PackageManager.GET_ACTIVITIES);
      }
      catch (PackageManager.NameNotFoundException e) {
          return (false);
      }
      return (true);
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setStyle(DialogFragment.STYLE_NO_FRAME, R.style.CustomDialog);
  }
  
  @Override
  public void onStart() {
      super.onStart();
      getDialog().getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
      getDialog().setCanceledOnTouchOutside(true);
  
  }
  
  private String convertNumber(String number) {
      StringBuffer sb = new StringBuffer(number);
      sb.insert(2," (");
      sb.insert(7,") ");
      sb.insert(12,"-");
      sb.insert(15,"-");
      return String.valueOf(sb);
  }
  }
  </code></pre>
  
  <p>And also I have the next Layout file</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="match_parent" android:layout_height="wrap_content"&gt;
  
  &lt;LinearLayout
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
  
      &lt;RelativeLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:paddingTop="14dp"
          android:background="@color/whiteTextView"
          android:id="@+id/contactsLayout"&gt;
  
          &lt;ImageView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:paddingTop="6dp"
              android:layout_marginTop="16dp"
              android:layout_marginLeft="16dp"
              android:layout_marginStart="16dp"
              android:layout_marginBottom="16dp"
              android:background="@drawable/phone_grey1"
              android:id="@+id/phoneImage" /&gt;
  
          &lt;TextView
              android:id="@+id/contactNumber"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textColor="@color/blackTextView"
              android:text="Все"
              android:textSize="18sp"
              android:layout_above="@+id/contactTV"
              android:layout_alignLeft="@+id/contactTV"
              android:layout_alignStart="@+id/contactTV" /&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/contactsString"
              android:textSize="12sp"
              android:textColor="@color/greyTextView"
              android:layout_marginLeft="25dp"
              android:layout_marginStart="25dp"
              android:id="@+id/contactTV"
              android:layout_alignBottom="@+id/phoneImage"
              android:layout_toRightOf="@+id/phoneImage"
              android:layout_toEndOf="@+id/phoneImage" /&gt;
      &lt;/RelativeLayout&gt;
  
      &lt;RelativeLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:id="@+id/skypeContactsLayout"
          android:background="@color/whiteTextView"
          android:layout_below="@+id/contactsLayout"
          android:layout_centerHorizontal="true"&gt;
  
          &lt;ImageView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:paddingTop="6dp"
              android:layout_marginTop="16dp"
              android:layout_marginLeft="16dp"
              android:layout_marginStart="16dp"
              android:layout_marginBottom="16dp"
              android:background="@drawable/skype1"
              android:id="@+id/skypeImage" /&gt;
  
          &lt;TextView
              android:id="@+id/skypeName"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textColor="@color/blackTextView"
              android:text="Все"
              android:textSize="18sp"
              android:layout_above="@+id/skypeTV"
              android:layout_alignLeft="@+id/skypeTV"
              android:layout_alignStart="@+id/skypeTV"/&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/skypeString"
              android:textSize="12sp"
              android:textColor="@color/greyTextView"
              android:layout_marginLeft="25dp"
              android:layout_marginStart="25dp"
              android:id="@+id/skypeTV"
              android:layout_alignBottom="@+id/skypeImage"
              android:layout_toRightOf="@+id/skypeImage"
              android:layout_toEndOf="@+id/skypeImage" /&gt;
  
      &lt;/RelativeLayout&gt;
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@color/whiteTextView"
          android:paddingBottom="14dp"
          android:id="@+id/allUserFlats"
          android:layout_below="@+id/skypeContactsLayout"
          android:layout_centerHorizontal="true"&gt;
  
          &lt;ImageView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:paddingTop="6dp"
              android:layout_centerVertical="true"
              android:layout_marginTop="16dp"
              android:layout_marginLeft="16dp"
              android:layout_marginStart="16dp"
              android:layout_marginBottom="16dp"
              android:background="@drawable/hamburger1"
              android:id="@+id/otherOffersImage" /&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/allFlats"
              android:layout_marginLeft="25dp"
              android:layout_marginStart="25dp"
              android:textSize="18sp"
              android:textColor="@color/blackTextView"
              android:id="@+id/otherOffersTV"
              android:layout_centerVertical="true"
              android:layout_toRightOf="@+id/otherOffersImage"
              android:layout_toEndOf="@+id/otherOffersImage" /&gt;
  
      &lt;/RelativeLayout&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>And my style file </p>
  
  <pre><code>&lt;style name="CustomDialog" parent="@android:style/Theme.Holo.Light" &gt;
      &lt;item name="android:windowIsFloating"&gt;true&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>