SmartPopupWindow Save

提供关于PopupWindow使用过程中遇到的一些特殊问题的解决方案,例如:PopupWindow不响应点击外部消失和返回键消失的解决方法;PopupWindow精确计算要显示位置原理和方法;实现带箭头的上下文菜单遇到的坑;Android7.0 PopupWindow的兼容问题;屏幕旋转时调用PopupWindow update方法更新位置失效的问题及解决方案

Project README

SmartPopupWindow

提供关于PopupWindow使用过程中遇到的一些特殊问题的解决方案

  1. PopupWindow不响应点击外部消失和返回键消失的解决方法
    博文地址:http://www.cnblogs.com/popfisher/p/5608717.html

  2. PopupWindow精确计算要显示位置原理和方法
    博文地址:http://www.cnblogs.com/popfisher/p/5608436.html

  3. 不得不吐槽的Android PopupWindow的几个痛点(实现带箭头的上下文菜单遇到的坑)
    博文地址:http://www.cnblogs.com/popfisher/p/5944054.html

  4. Android7.0 PopupWindow的兼容问题,修复了问题1和3中描述的问题,但是由引入了新的问题吗,具体详情
    博文地址:http://www.cnblogs.com/popfisher/p/6434757.html
    Github地址:https://github.com/PopFisher/SmartPopupWindow/blob/master/7.0PopupWindow.md

  5. 屏幕旋转时调用PopupWindow update方法更新位置失效的问题及解决方案。
    博文地址:http://www.cnblogs.com/popfisher/p/8029616.html
    Github地址:https://github.com/PopFisher/SmartPopupWindow/blob/master/ScreenRotateUpdatePopup.md

效果如下图所示:##

问题1截图

不会响应外部点击消失事件的情况

问题2截图

动态计算弹出框的位置 动态计算弹出框的位置

问题3截图

![第一排左边按钮菜单](/docpic/topleft.png "符合预期") 第一排右边按钮菜单 第二排中间按钮菜单

问题4相关截图

![7.0主Activity](/docpic/7.0.png "7.0 PopupWindow兼容性测试")

1. PopupWindow高宽都设置为match_parent:从屏幕左上角弹出

![](/docpic/7.0_1.png "PopupWindow高宽都设置为match_parent")

2. 宽度wrap_content-高度match_parent:从屏幕左上角弹出

![](/docpic/7.0_2.png "宽度wrap_content-高度match_parent")

3. 宽度match_parent-高度wrap_content:从anchorView下方弹出

![](/docpic/7.0_3.png "宽度match_parent-高度wrap_content")

4. 宽度wrap_content-高度大于anchorView到屏幕底部的距离:从anchorView上方弹出,与anchorView左对齐

![](/docpic/7.0_4.png "宽度wrap_content-高度大于anchorView到屏幕底部的距离")

5. showAtLocation传入Gravity.Bottom:从anchorView下方弹出

![](/docpic/7.0_5.png "宽度wrap_content-高度大于anchorView到屏幕底部的距离")

6. 调用update方法更新第5点中弹出PopupWindow,发现PopupWindow的Gravity发生了改变

详细可以参考 http://www.jianshu.com/p/0df10893bf5b

![](/docpic/7.0_6.png "调用update方法更新弹出Popup")

Open Source Agenda is not affiliated with "SmartPopupWindow" Project. README Source: PopFisher/SmartPopupWindow
Stars
665
Open Issues
3
Last Commit
3 years ago

Open Source Agenda Badge

Open Source Agenda Rating