CustomPopwindow icon indicating copy to clipboard operation
CustomPopwindow copied to clipboard

android 7.0 demo 中的poplist 是全屏

Open KomoriWu opened this issue 7 years ago • 6 comments

KomoriWu avatar May 03 '18 14:05 KomoriWu

是的 不知道楼上的兄弟解决了吗

superzhangbao avatar May 14 '18 08:05 superzhangbao

@superzhangbao 嗯嗯,我用原生的写了。 想要popWindows正常在Android7.0系统正常显示,我们需要重写popWindows的showAsDropDown方法: public class PopWindowSelectCondition extends PopupWindow {

@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);
}

} 按照平时那样调用就行

KomoriWu avatar May 14 '18 08:05 KomoriWu

@KomoriWu 好的 谢谢兄弟

superzhangbao avatar May 14 '18 08:05 superzhangbao

客气

KomoriWu avatar May 14 '18 08:05 KomoriWu

嗯,那是7.0的一个bug,Android 7.1 已经改了,如果自己适配判断版本== 24就行了,代码中已经添加了,有几个测试还没通过,测试完了我会更新上来

pinguo-zhouwei avatar May 14 '18 08:05 pinguo-zhouwei

@pinguo-zhouwei 好的

superzhangbao avatar May 14 '18 08:05 superzhangbao