public LayoutParams getClingWindowLayoutParams() { LayoutParams lp = new LayoutParams(-1, -1, 2005, 16777480, -3); lp.privateFlags |= 16; lp.setTitle(TAG); lp.windowAnimations = 16974566; lp.gravity = 119; return lp; }
private void initFloatView() { wmParams = new LayoutParams(); wmParams.format = PixelFormat.RGBA_8888; wmParams.x = PreSetting.getInstance().getFloatViewX(); wmParams.y = PreSetting.getInstance().getFloatViewY(); wmParams.width = LayoutParams.WRAP_CONTENT; wmParams.height = LayoutParams.WRAP_CONTENT; wmParams.flags = LayoutParams.FLAG_SHOW_WHEN_LOCKED | LayoutParams.FLAG_NOT_FOCUSABLE; wmParams.type = LayoutParams.TYPE_PHONE; wmParams.windowAnimations = android.R.style.Animation_Translucent; LayoutInflater inflater = LayoutInflater.from(getApplication()); mFloatView = inflater.inflate(R.layout.layout_floatbutton, null); mFloatView.setOnTouchListener(onTouchListener); mFloatView.setOnClickListener(onClickListener); ((ButtonFloatSmall) mFloatView).setRippleColor(Color.TRANSPARENT); // ((ButtonFloatSmall)mFloatView).getBackground().setAlpha(50); }