title: Custom Popupwindow for all screensize android
body: <p>I am using a custom popup window. On Load I have to pass the height and width of the window. But I want to load the popup for all screensizes. I am using the below function to load my popup.</p>
  
  <pre><code>private void loadPopup() {
      LayoutInflater inflater = this.getLayoutInflater();
      final View layout = inflater.inflate(R.layout.activity_pop_up_ad, null);
  
      final PopupWindow windows = new PopupWindow(layout , 300,500,true);
  
      layout.post(new Runnable() {
          public void run() {
              windows.showAtLocation(layout,Gravity.CENTER, 0, 0);
          }
  
      });
      ImageButton close = (ImageButton) layout.findViewById(R.id.close);
         close.setOnClickListener(new OnClickListener() {
  
           @Override
           public void onClick(View v) {
               windows.dismiss();
           }
         });
  }
  </code></pre>
  
  <p>I tried this one. But it completes the screen size. I don't want that much filled.</p>
  
  <pre><code>windows.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  </code></pre>
  
  <p>Any ideas?</p>