junixapp/XPopup

部分红米低端机发现的 弹框位移相差一个 bar 的距离的bug

Opened this issue · 1 comments

XPopup版本
所有版本

手机系统和型号
红米note9 最新系统

描述你的问题
横屏应用发现的 包括 BubbleAttachPopupView BubbleAttachPopupView
部分红米低端机发现的 弹框位移相差一个 bar 的距离的bug

解决方案: eg
AttachPopupView
-> public void doAttach()
->
if (isShowUpToTarget()) {
//说明上面的空间比较大,应显示在atView上方
// translationX: 在左边就和atView左边对齐,在右边就和其右边对齐
translationY = rect.top - getPopupContentView().getMeasuredHeight() - defaultOffsetY;
} else {
translationY = rect.bottom + defaultOffsetY;
}
getPopupContentView().setTranslationX(translationX);
getPopupContentView().setTranslationY(translationY);
initAndStartAnimation();
}
});
}
}
改为:

if (isShowUpToTarget()) {
                    //说明上面的空间比较大,应显示在atView上方
                    // translationX: 在左边就和atView左边对齐,在右边就和其右边对齐
                    translationY = rect.top - getPopupContentView().getMeasuredHeight() - defaultOffsetY;
                } else {
                    translationY = rect.bottom + defaultOffsetY;
                }
                //wss md c202
                  int[] locations = new int[2];
                getPopupContentView().getLocationOnScreen(locations);
                getPopupContentView().setTranslationX(translationX-locations[0]);
                //wss md  c202 end
                getPopupContentView().setTranslationY(translationY);
                initAndStartAnimation();
            }
        });
    }
}

用 ImmersionBar 库设置的 全面屏幕 .hideBar(BarHide.FLAG_HIDE_BAR)
在popview模式上 上是可以的 但是在dialog 模式下就会触发偏移