title: Popup window size in android
body: <p>I'm creating a popup window in a listactivity in the event onListItemClick.</p>
  
  <pre><code>LayoutInflater inflater = (LayoutInflater)
  this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View pop = inflater.inflate(R.layout.popupcontact, null, false);
  ImageView atnot = (ImageView)pop.findViewById(R.id.aNot);
  height = pop.getMeasuredHeight();
  width = pop.getMeasuredWidth();
  Log.e("pw","height: "+String.valueOf(height)+", width: "+String.valueOf(width));
  atnot.setOnClickListener(new View.OnClickListener() {
  
      @Override
      public void onClick(View v) {
          pw.dismiss();
      }
  });
  
   pw = new PopupWindow(pop, width, height, true);
  
   // The code below assumes that the root container has an id called 'main'
   //pw.showAtLocation(v, Gravity.CENTER, 0, 0); 
   pw.showAsDropDown(v, 10, 5);
  </code></pre>
  
  <p>Now, the height and width variables were supposed to be height and width of the layout used for the popup window (popupcontact). But they return 0. I guess that is because the layout isn't rendered yet. Does anyone have a clue, how can I control the size of the popup window without needing to use absolute pixel numbers?</p>