在Android 7.0上PopupWindow.showAsDropDown不起作用

来源:互联网 发布:ip camea网络摄像机 编辑:程序博客网 时间:2024/05/20 15:11
public class Solve7PopupWindow extends PopupWindow {    public Solve7PopupWindow(View mMenuView, int matchParent, int matchParent1) {        super(mMenuView, matchParent,matchParent1);    }    @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);    }}
阅读全文
0 0
原创粉丝点击