public class SFPopupWindow extends PopupWindow {
public SFPopupWindow(Context context) {
super(context, null);
}
@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);
}
}
解决PopupWindow在7.0以上位置不正确的bug
最新推荐文章于 2023-03-06 14:34:51 发布