I am making a custom Android build in which my Service adds a view on top of each application. Using the following code:
WindowManager mWM = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE); LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(); mParams = new WindowManager.LayoutParams( WindowManager.LayoutParams.TYPE_PHONE, WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT); mParams.height = 117; mParams.width = 366; View myView = inflater.inflate(R.layout.myView,null); mWM.addView(myView, mParams);
I can successfully add a view. I am animating a view using
PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("x", 300); ObjectAnimator.ofPropertyValuesHolder(myView, pvhX).start();
I see a view animation, but not a window. The transparent window where the image used to be is not animated. This is the same behavior as described in Android Animation Animation.
Another drawback of the view animation system is that it only changed the place where the View was displayed, and not the actual view. For example, if you animated a button to move around the screen, the button draws correctly, but the actual place where you can click the button does not change, so you need to implement your own logic to handle this.
How do I animate a window with a view?
thanks
source share