title: How to make the width of an AbstractDialogFragment extended class match the window width?
body: <p>I'm displaying a dialog in my mobile application, using an AbstractDialogFragment extended class. How do I set the width to match the size of the screen?</p>
  
  <p>I've already tryed to override the onResume() method and setting the width and height, getting the window's dimensions, but i'd like to set just the width.</p>
  
  <p>Here is what I tryed:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Override
  public void onResume()
  {
      super.onResume();
      Window window = getDialog().getWindow();
  
      // ...
      // get window width and height
      // ...
  
      window.setLayout(width, height);
      window.setGravity(Gravity.CENTER);
  }
  </code></pre>
  
  <p>I expect the dialogs width to be relative to the screen width.</p>