title: set custom layout to screen height
body: <p>I have to add a layout to the screen height removing action bar height. I am using below code -</p>
  
  <pre><code>View popupView = getLayoutInflater().inflate(
                  R.layout.left_interaction_layout, null);
          double screenSize = 0;
      try {
          DisplayMetrics dm = new DisplayMetrics();
          context.getWindowManager().getDefaultDisplay().getMetrics(dm);
          int width = dm.widthPixels;
          int height = dm.heightPixels;
          int dens = dm.densityDpi;
          double wi = (double) width / (double) dens;
          double hi = (double) height / (double) dens;
          double x = Math.pow(wi, 2);
          double y = Math.pow(hi, 2);
          screenSize = Math.sqrt(x + y);
      } catch (Exception e) {
          // TODO: handle exception
      }
          double screenByTwoSize = screenSize / 3;
  
          DisplayMetrics metrics = new DisplayMetrics();
          getWindowManager().getDefaultDisplay().getMetrics(metrics);
          // int width = metrics.widthPixels;
          // int height = metrics.heightPixels;
          float mXDpi = metrics.xdpi;
          float mYDpi = metrics.ydpi;
          int screenWidth = (int) Math.round(screenByTwoSize * mXDpi);
          int screenHeight = (int) Math.round(screenByTwoSize * mYDpi);
  
          popup = new PopupWindow(popupView, screenWidth, 200, true);
          popup.setBackgroundDrawable(new BitmapDrawable());
          // Get ListView object from xml
          final ListView listView = (ListView) popupView
                  .findViewById(R.id.list);
          try {
              popup = new PopupWindow(popupView, 120, screenHeight * 2 + 250,
                      true);
              popup.setBackgroundDrawable(new BitmapDrawable());
          } catch (Exception e) {
              // TODO: handle exception
          }
  
          popup.setOutsideTouchable(true);
          // popup.showAsDropDown(tvcountry);
          Rect location = LoginActivity.locateView(v);
          popup.showAtLocation(v, Gravity.TOP | Gravity.LEFT, 0,
                  location.bottom);
          popup.update();
          popup.setOnDismissListener(new PopupWindow.OnDismissListener() {
  
              @Override
              public void onDismiss() {
  
              }
          });
  </code></pre>
  
  <p>I have hardcoded height which may be different for different screen size. How can I achieve that dynamically. I have to make this layout to screen height with removing action bar height so it will work like navigation drawer</p>
  
  <p>Thanks in Advance</p>