title: display PopupWindow on top of RecyclerView Adapter layout item
body: <p>I am displaying JSON data inside RecyclerView , I added long press action on RecyclerView item , which display <a href="https://developer.android.com/reference/android/widget/PopupWindow" rel="nofollow noreferrer">PopupWindow</a>. I want to display that <a href="https://developer.android.com/reference/android/widget/PopupWindow" rel="nofollow noreferrer">PopupWindow</a> on Top of each Recyclerview item when i long click on it. </p>
  
  <p>but PopupWindow only display on TOP of parent screen not on top of Recyclerview item.</p>
  
  <p>i want that PopupWindow should display at TOP of each RecyclerView item layout.</p>
  
  <p>here is my code for Displaying PopupWindow</p>
  
  <pre><code>private void PopUpWindowOption(LinearLayout mainLayout)
      {
  
          View customView = LayoutInflater.from(context).inflate(R.layout.popup,null);
  
          Button closePopupBtn = (Button) customView.findViewById(R.id.closePopupBtn);
  
          final PopupWindow popupWindow = new PopupWindow(customView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  
  
  
          closePopupBtn.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  popupWindow.dismiss();
                  Toast.makeText(context,"clicked",Toast.LENGTH_SHORT).show();
              }
          });
  
          popupWindow.showAtLocation(mainLayout, Gravity.TOP, 0, 0);
  
      }
  </code></pre>
  
  <p>Output</p>
  
  <p><a href="https://i.stack.imgur.com/8GCf7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8GCf7.png" alt="enter image description here"></a></p>
  
  <p>How can i achieve this help me.
  Thank you</p>