zyyoona7/EasyPopup

窗口高度为奇数时,最底部1px高度忽隐忽现

Closed this issue · 7 comments

假如窗口高度为奇数时,最底部1px高度忽隐忽现,描边1px看更明显。窗口高度刚好是偶数的时候是正常的,有动态数据时,一个笨方法是计算设置偶数高度,希望有更好的解决方法

@luoh1234 没太看明白,在什么使用场景?如果允许可以贴一下代码

EasyPopup mPop = new EasyPopup(getContext())
.setContentView(view)
//是否允许点击PopupWindow之外的地方消失
.setFocusAndOutsideEnable(true)
.setWidth(width)
.setHeight(211)
.createPopup();
mPop.showAsDropDown(selfView);

你把要弹框显示的视图高度(view)设置为奇数,比如211,看底部的那1px高度会不会忽隐忽现

@luoh1234 是连续 dismiss/show 的时候吗?我通过日志观察高度一直是设置的宽高,没有你说的情况。

mCirclePop.setOnAttachedWindowListener(new EasyPopup.OnAttachedWindowListener() {
            @Override
            public void onAttachedWindow(int width, int height, EasyPopup easyPop) {
                LogUtils.i("width="+width+",height="+height);
            }
        });
I/EasyPopActivity: ╔═══════════════════════════════════════════════════════════════════════════════════════════════════
I/EasyPopActivity: ║ main, onAttachedWindow(EasyPopActivity.java:147)
                   ║ width=212,height=211
I/EasyPopActivity: ╚═══════════════════════════════════════════════════════════════════════════════════════════════════
I/EasyPopActivity: ╔═══════════════════════════════════════════════════════════════════════════════════════════════════
I/EasyPopActivity: ║ main, onAttachedWindow(EasyPopActivity.java:147)
                   ║ width=212,height=211
I/EasyPopActivity: ╚═══════════════════════════════════════════════════════════════════════════════════════════════════
I/EasyPopActivity: ╔═══════════════════════════════════════════════════════════════════════════════════════════════════
I/EasyPopActivity: ║ main, onAttachedWindow(EasyPopActivity.java:147)
                   ║ width=212,height=211
I/EasyPopActivity: ╚═══════════════════════════════════════════════════════════════════════════════════════════════════

实际高度不会变,你观察一下窗口最底部视图,如果不容易看出来可以描边看一下比较明显

@luoh1234 在我的小米 Mix2 上依然没看到你说的这种现象,可以告知一下你的手机型号和系统版本吗?最好再贴一下你测试的完整代码

机型是PS1562A ,配置很低的收银机。我刚试过手机和另一台好一点的收银机没问题,系统或硬件配置低吧我的问题可忽略