其实这个实现很简单!就是在WindowManager中添加一个显示view
floatView = new FloatView(getApplicationContext());
floatView.setOnClickListener(this);
floatView.setImageResource(R.drawable.ic_launcher);
windowManager = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
windowManagerParams = ((FloatApplication) getApplication()).getWindowParams();
windowManagerParams.type = LayoutParams.TYPE_PHONE;
windowManagerParams.format = PixelFormat.RGBA_8888;
windowManagerParams.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL
| LayoutParams.FLAG_NOT_FOCUSABLE;
windowManagerParams.gravity = Gravity.LEFT | Gravity.TOP;
windowManagerParams.x = 0;
windowManagerParams.y = 0;
windowManagerParams.width = LayoutParams.WRAP_CONTENT;
windowManagerParams.height = LayoutParams.WRAP_CONTENT;
windowManager.addView(floatView, windowManagerParams);