muslimgift.blogg.se

WindowManager not working
WindowManager not working













WindowManager not working

Returning true from all of them will help you receive all the events, but that's not necessary. If you can capture the onTouchEvent you know that you've touched the circle, so you don't need to perform coordinate checks by using the raw values (I'm referring to isPointInside() function).That way, you can move the view with the touch event. Manager.updateViewLayout(this, getLayoutParams()) WindowManager manager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE) This will get the same window manager the service has. If the first way doesn't work, 2nd will work.

#WindowManager not working update#

To update the view, you need to either call requestLayout() or ((WindowManager.LayoutParams) getLayoutParams()).y = targetY ((WindowManager.LayoutParams) getLayoutParams()).x = targetX update the layout params of the view like this: In your onTouchEvent you can do something like this: // Assuming you know the new x and y values of the view, you can _WATCH_OUTSIDE_TOUCH /* outsideTouch */,Īfter that, moving the view would actually require to change your layout params and updating the view layout.

WindowManager not working

WindowManager.LayoutParams params = new WindowManager.LayoutParams(circleSize /* width */, Int circleSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DP, 40, getResources().getDisplayMetrics()) Target the top-right corner of the screen.Īnd view parameters would look like this: // Assuming your view has a 40 dp width and height, Int circleWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DP, 40, getResources().getDisplayMetrics()) Assuming your view has a 40 dp width and height, Manager.getDefaultDisplay().getSize(point) Top-right would look like this: WindowManager manager = (WindowManager) getSystemService(Context.WINDOW_SERVICE) For instance, top-left would look like this: params.x = 0 So, I'll give an example approach on how you can do it.Īdding the view in left and right corner can be specified in the layout params you are creating. I'm not entirely sure what the parent does, I believe you're trying to move the circle view here after touching it, with a drag operation or some sort. In your case, the event wouldn't reach your window, and that would mean you can't handle the event at all. They all depend on whether the event actually reaches your view, and even then, returning false wouldn't pass the event to the below screen, because they are different processes. Whether you're using intercept, returning false etc. You can't do that on the same view I'm afraid, because the touch event either enters to your view, or it does not. tOnTouchListener(new View.OnTouchListener() boolean onTouch(View view, MotionEvent motionEvent) /*this.animate().x(event.getRawX()).y(event.getRawY())Īlso tried returning false in onTouchEvent of CircleDraggingView and also to main mFloatingView (Root View ).

WindowManager not working

MFloatingView = om(this).inflate(R.em_circle_dragging, null) /| _NOT_TOUCHABLE, this flag can make it in touchable. LayoutParams.TYPE_APPLICATION_OVERLAY : _PHONE įinal WindowManager.LayoutParams params = new WindowManager.LayoutParams( int LAYOUT_FLAG = _INT >= Build.VERSION_CODES.O ? WindowManager. WindowManager don't let the visible item clickable. But when I click on visible Home Screen button. I make them draggable on screen that's working fine. I have two small circle in left and right corner. My view must be match parent and handle circle touch listener and pass the rest touch to the below screen it's width and height are _PARENT with transparent background. I have drawn an overlay using WindowManager.















WindowManager not working