PopupWindow的showAsDropDown位置问题 Android7.0
重写showAsDropDown(View anchor)方法
@Override
public void showAsDropDown(View anchor) {
if(Build.VERSION.SDK_INT == 24) {
Rect rect = new Rect();
anchor.getGlobalVisibleRect(rect);
int h = anchor.getResources().getDisplayMetrics().heightPixels - rect.bottom;
setHeight(h);
}
super.showAsDropDown(anchor);
}
本文介绍了一种针对Android 7.0系统中PopupWindow显示位置不准确的问题解决方案。通过重写showAsDropDown方法并获取视图的全局可见矩形来调整高度。
2520

被折叠的 条评论
为什么被折叠?



