WindowManager.LayoutParams lp = new WindowManager.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_APPLICATION, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, PixelFormat.TRANSLUCENT); lp.gravity = Gravity.LEFT | Gravity.TOP; lp.x = 100; lp.y = 100; WindowManager windowManager = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE); ImageView view = new ImageView(this); view.setBackgroundResource(R.drawable.icon); windowManager.addView(view, lp);
转载于:https://www.cnblogs.com/gongcb/archive/2012/10/09/2716395.html