首页 > 学院 > 开发设计 > 正文

解决PopupWindow在7.0以上位置不正确的bug

2019-11-07 23:51:39
字体:
来源:转载
供稿:网友
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); }}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表