Android floating box problem

  android, question

A floating box has been added to the interface to allow mouse_event to use another mobile phone to control the movement. How can the mouse move out of the screen? It seems that it cannot move out at all.

mWM = (WindowManager) getBaseContext().getSystemService(Context.WINDOW_SERVICE);
 ivCursor = new ImageView(getBaseContext());
 ivCursor.setImageResource(R.drawable.mouse);
 
 mParams = new WindowManager.LayoutParams();  //Describe the object for parameters of ivCursor object
 mParams.height = WindowManager.LayoutParams.WRAP_CONTENT;  //width adaptation
 mParams.width = WindowManager.LayoutParams.WRAP_CONTENT;  //highly adaptive
 mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;  //Set to Cannot Get Focus
 mParams.type = LayoutParams.TYPE_PHONE;
 //Set Joint Photographic Experts Group, the effect is transparent background
 mParams.format = PixelFormat.RGBA_8888;
 mParams.gravity = Gravity.TOP | Gravity.LEFT;
 // mParams.gravity = Gravity.CENTER;
 Display display = getWindowManager().getDefaultDisplay();
 int w = display.getWidth() / 2;
 int h = display.getHeight() / 2;
 mParams.x = (int) (clientwidth / 2);  //x-axis distance from the origin of the screen
 mParams.y = (int) (clientheight / 2);  //Y-Axis Distance from Screen Origin
 mWM.addView(ivCursor, mParams);

You can try windowmanager.layoutparams.flag _ layout _ no _ limits.

mParams.flags = WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;