How to show the arrow on exactly top of view ?
vinodkumarnalla opened this issue · 2 comments
vinodkumarnalla commented
How to show the arrow on exactly top of view ?
hament9193 commented
I have the same problem. The arrow position is with respect to the popup's width. I want to set it at middle of the target view's x coordinate. This makes it very complex to manage. It should have been with respect to main screen.
hament9193 commented
After a few trials. got it working with below code.
final int[] location = new int[2];
view.getLocationInWindow(location);
bubbleLayout.setArrowDirection(ArrowDirection.BOTTOM_CENTER);
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
int displayWidth = metrics.widthPixels;
int offsetX = location[0] - displayWidth/2 + view.getWidth()/2;
int offsetY = location[1] + view.getHeight();
popupWindow.showAtLocation(view, Gravity.BOTTOM, offsetX, offsetY);