Open jehutyx opened 8 years ago
Hey,
This is quite a late response but in case anyone else is still looking for a similar solution, after skimming over the WindowManager implementation I think that the following is a possible solution for moving the bubble:
// params to represent the new position
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT
);
params.gravity = Gravity.TOP | Gravity.LEFT;
params.x = 0;
params.y = 100;
// get instance of window manager and use it to update the bubble's position
bubble.getWindowManager().updateViewLayout(bubble, params);
// notify the bubble's layout coordinator
if (bubble.getLayoutCoordinator() != null) {
bubble.getLayoutCoordinator().notifyBubblePositionChanged(this, x, y);
}
Note: this will likely just 'teleport' the bubble without a smooth transition. If you're after a smooth transition you'll probably need to add an animation for the params, this might help: https://stackoverflow.com/questions/8664939/animate-view-added-on-windowmanager
hi, there is a way to move the bubble to initial position? when i click the bubble i display a popup window, but i need a way to move the bubble to upper left corner of the screen.
thanks in advance