Place A Image At The Touched Area In Android
I need to create a image wherever the user touched on the screen. If the user touches more places, the image should be shown in all the places. I used the following code. package c
Solution 1:
You need to update the view's position, instead of just add it again.
Here's how to do it:
WindowManagerwindowsManager= (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)
WindowManager.LayoutParamswindowParams=newWindowManager.LayoutParams();
windowParams.x = <newX coord>;
windowParams.y = <newY coord>
windowParams.height = myImageView.getHeight();
windowParams.width = myImageView.getWidth();
windowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
windowParams.format = PixelFormat.TRANSLUCENT;
windowParams.windowAnimations = 0;
windowManager.updateViewLayout(myImageView, windowParams);
Post a Comment for "Place A Image At The Touched Area In Android"