MasayukiSuda / BubbleLayout

Bubble View for Android.
973 stars 135 forks source link

Issue in showing BubbleLayout in 7.0 OS #7

Open hshah67 opened 7 years ago

hshah67 commented 7 years ago

os_7_0

OS_7_0

Issue in showing bubble layout os_6_0

OS_6_0

MasayukiSuda commented 7 years ago

Will you paste the code you wrote here?

hshah67 commented 7 years ago

getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() {

            int calculatedGravity = mGravity;
            if (calculatedGravity == GRAVITY_AUTO) {

                if (getHeight() < getMaxAvailableTopHeight(anchor)) {
                    calculatedGravity = GRAVITY_TOP;
                } else {
                    calculatedGravity = GRAVITY_BOTTOM;
                }
            }

            int x, y;
            int[] locationOnScreen = new int[2];
            anchor.getLocationOnScreen(locationOnScreen);
            if (calculatedGravity == GRAVITY_TOP) {
                **y = locationOnScreen[1] - getHeight();**
                setArrowDirection(ArrowDirection.BOTTOM);
            } else {
                y = locationOnScreen[1] + anchor.getHeight();
                setArrowDirection(ArrowDirection.TOP);
            }

            x = calculateXAndSetArrowPosition(anchor);

            mPopupWindow.update(x, y, -1, -1);
            getViewTreeObserver().removeOnGlobalLayoutListener(this);
        }
    });

here isssue is in getHeight(). in both device we are getting different value for getHeight() for bubblelayout.

pj210493 commented 7 years ago

@hshah67 @MasayukiSuda How to give margin from right to bubble view .