WindowManager.LayoutParams layoutParams = (WindowManager.LayoutParams) mDragView.getLayoutParams();
layoutParams.x = 0;
layoutParams.y = 0;
WindowManager mWindowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
mWindowManager.updateViewLayout(mDragView, layoutParams);
The gravity for this LayoutParams was set as Gravity.TOP.
Instead use:
mWindowParams.gravity = Gravity.LEFT | Gravity.TOP;
This would plot (0,0) at left top.
Regards.
No comments:
Post a Comment