title: Why my EditText copy/paste menu is under the EditText? How change the z-order of popup window?
body: <p><strong>NOTE</strong></p>
  
  <p>If someone know how to <strong>order (z-order) Windows added via windowmanager, i will also accept the answer</strong> because it's will answer all the question. Actually i only find to do <code>windowManager.removeView(MyView)</code> following immediatly by <code>windowManager.addView(MyView)</code> to put a view in front of the other, but this is not ideal because it's visually remove and add the view. it's look crazy that their is no build in function in android to do such a simple think.</p>
  
  <hr>
  
  <p>I create a view (linearlayout) that contain an EditText. I add this view in the activity via WindowManager.addView (view, Layout_Params); </p>
  
  <p>but i have problem that every popup the edittext will generate (like copy/past menu or word suggestion menu) will be under other views, under even their owning EditText view (not on the picture the edittext have a transparent background)</p>
  
  <p><a href="https://i.stack.imgur.com/U4HzZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U4HzZ.png" alt="also something a little strange, the popup generate by the last EditText w"></a>ill be </p>
  
  <p><a href="https://i.stack.imgur.com/b1ZEj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b1ZEj.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/w7z3d.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w7z3d.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/S6nEd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S6nEd.png" alt="enter image description here"></a></p>
  
  <p>i create the views (ie: LinearLayout) with theses layout params :</p>
  
  <pre><code>protected WindowManager.LayoutParams createLayoutParams() {
      WindowManager.LayoutParams p = new WindowManager.LayoutParams();
      p.gravity = Gravity.LEFT | Gravity.TOP;     
      p.width = 0;
      p.height = 0;                       
      p.format = PixelFormat.TRANSLUCENT;
      p.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED;
      p.flags = NOT_FOCUSABLE_FLAGS;
      // TYPE_APPLICATION allows for popups in browser windows (like edit menus)
      p.type = WindowManager.LayoutParams.TYPE_APPLICATION; 
      p.token = null; 
  
      return p;
  }
  </code></pre>
  
  <p>and i show the view (who contain just an edittext) like this :</p>
  
  <pre><code>    private final WindowManager mWindowManager;
      mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
  
      WindowManager.LayoutParams lp = createLayoutParams();
      mWindowManager.addView(view, lp);
  </code></pre>
  
  <p>so how to make the popup connected to the editText in front of everything ?</p>
  
  <p>This question can also maybe help a little (about z-order of window view): <a href="https://stackoverflow.com/questions/44231597/how-work-the-z-order-of-view-added-via-windowmanager">How work the z-order of view (ie: window) added via WindowManager?</a></p>