PopWindow解决Android7.0调用showAsDro

2017-01-04  本文已影响208人  middle2021
PopWindow解决Android7.0调用showAsDropDown方法失效问题

for example
        if (Build.VERSION.SDK_INT < 24) {
            pop.showAsDropDown(view);
        } else {
            // 适配 android 7.0
            int[] location = ViewUtil.getViewPositionByScreen(view);
            int x = location[0];
            int y = location[1];
            pop.showAtLocation(view, Gravity.NO_GRAVITY, 0, y + view.getHeight());
        }
上一篇下一篇

猜你喜欢

热点阅读