Android 7.0以上(包含8.0), popupWindow弹窗位置异常, 解决方案
本文转载地址:https://blog.csdn.net/zhihui_520/article/details/79097161终极解决方案(7.0, 7.1, 8.0)/**** @param pwpopupWindow* @param anchor v* @param xoffx轴偏移* @param yoffy轴偏移*/publi...
·
本文转载地址:https://blog.csdn.net/zhihui_520/article/details/79097161
终极解决方案(7.0, 7.1, 8.0)
/**
*
* @param pw popupWindow
* @param anchor v
* @param xoff x轴偏移
* @param yoff y轴偏移
*/
public static void showAsDropDown(final PopupWindow pw, final View anchor, final int xoff, final int yoff) {
if (Build.VERSION.SDK_INT >= 24) {
Rect visibleFrame = new Rect();
anchor.getGlobalVisibleRect(visibleFrame);
int height = anchor.getResources().getDisplayMetrics().heightPixels - visibleFrame.bottom;
pw.setHeight(height);
pw.showAsDropDown(anchor, xoff, yoff);
} else {
pw.showAsDropDown(anchor, xoff, yoff);
}
}
更多推荐
已为社区贡献5条内容
所有评论(0)