title: Android Dialog fragment change size
body: <p>I'm trying to create a dialog fragment that takes 98% of width and 90% percent of height</p>
  
  <pre><code>   @Override
      public Dialog onCreateDialog(Bundle savedInstanceState) {
          Dialog dialog = new Dialog(getActivity());
          int width = (int)(0.98 * getResources().getDisplayMetrics().widthPixels);
          int height = (int)(0.9 * getResources().getDisplayMetrics().heightPixels);
  
          dialog.getWindow().setLayout(width, height);
          dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
          dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
  
          View root = getActivity().getLayoutInflater().inflate(R.layout.dialog_collector_rating, null);
          getReference(root);
          dialog.setContentView(root);
  
          return dialog;
      }
  
      private void getReference(View root){
  
          if(mRates == null){
              mRates = new ArrayList&lt;TopRateDataItem&gt;();
          }
  
          // list
          ListView ratingList = (ListView) root.findViewById(R.id.ratingList);
          RatingAdapter adapter = new RatingAdapter();
          ratingList.setAdapter(adapter);
  
          // workers number
          TextView tvWorkersNum = (TextView) root.findViewById(R.id.tvWorkersNum);
          tvWorkersNum.setText(getString(R.string.dialog_collector_rating_workers, mRates.size()));
  
          // button
          View btnClose = root.findViewById(R.id.btnClose);
          btnClose.setOnClickListener(this);
      }
  
  //    @Override
  //    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  //
  //        if(mRates == null){
  //            mRates = new ArrayList&lt;TopRateDataItem&gt;();
  //        }
  //
  //        // Inflate view
  //        View root = getActivity().getLayoutInflater().inflate(R.layout.dialog_collector_rating, null);
  //
  //        // list
  //        ListView ratingList = (ListView) root.findViewById(R.id.ratingList);
  //        RatingAdapter adapter = new RatingAdapter();
  //        ratingList.setAdapter(adapter);
  //
  //        // workers number
  //        TextView tvWorkersNum = (TextView) root.findViewById(R.id.tvWorkersNum);
  //        tvWorkersNum.setText(getString(R.string.dialog_collector_rating_workers, mRates.size()));
  //
  //        // button
  //        View btnClose = root.findViewById(R.id.btnClose);
  //        btnClose.setOnClickListener(this);
  //
  //        return root;
  //    }
  </code></pre>
  
  <p>The layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@android:color/white"
      android:orientation="vertical"&gt;
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:padding="5dp"
          android:gravity="center"
          android:background="@color/dialog_title_background"
          android:textSize="20sp"
          android:textStyle="bold"
          android:textColor="@color/dialog_title_text_color"
          android:text="@string/dialog_collector_rating_title"/&gt;
  
      &lt;ListView
          android:id="@+id/ratingList"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="1"
          android:focusable="false"
          android:focusableInTouchMode="false"/&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          android:padding="10dp"&gt;
  
          &lt;Button
              android:id="@+id/btnClose"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:paddingRight="25dp"
              android:paddingLeft="25dp"
              android:background="@drawable/button_grey_selector"
              android:textStyle="bold"
              android:textColor="@android:color/white"
              android:text="@string/dialog_collector_rating_button_text"/&gt;
  
          &lt;LinearLayout
              android:layout_width="0dp"
              android:layout_weight="1"
              android:layout_height="match_parent"
              android:orientation="horizontal"
              android:gravity="right|center_vertical"&gt;
  
              &lt;TextView
                  android:id="@+id/tvWorkersNum"
                  android:layout_width="0dp"
                  android:layout_weight="1"
                  android:layout_height="wrap_content"
                  android:textStyle="bold"
                  android:maxLines="1"/&gt;
  
              &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:padding="5dp"
                  android:text="@string/dialog_collector_rating_all"/&gt;
          &lt;/LinearLayout&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I tried with <code>onCreateDialog</code> and 'onCreateView' in both cases the dialog appears with no changes even when tried to enter hardcoded width and height.<br/>
  <strong>How to make that right?</strong></p>