在界面上加了一个浮动框来模拟鼠标 用另一个手机来控制 移动 怎么让这个鼠标移出屏幕啊 好像怎么都移不出去啊
mWM = (WindowManager) getBaseContext().getSystemService(Context.WINDOW_SERVICE);
ivCursor = new ImageView(getBaseContext());
ivCursor.setImageResource(R.drawable.mouse);
mParams = new WindowManager.LayoutParams();// 对ivCursor对象的参数描述对象
mParams.height = WindowManager.LayoutParams.WRAP_CONTENT;// 宽度自适应
mParams.width = WindowManager.LayoutParams.WRAP_CONTENT;// 高度自适应
mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;// 设置成不能获取焦点
mParams.type = LayoutParams.TYPE_PHONE;
// 设置图片格式,效果为背景透明
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轴距离
mParams.y = (int) (clientheight / 2);// 相对于屏幕原点的y轴距离
mWM.addView(ivCursor, mParams);