SmartPopupWindow

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

提供关于 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://raw.githubusercontent.com/PopFisher/SmartPopupWindow/master/7.0PopupWindow.md

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

效果如下图所示:

问题 1 截图

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

问题 2 截图

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

问题 3 截图

第一排左边按钮菜单 第一排右边按钮菜单 第二排中间按钮菜单

问题 4 相关截图

7.0 主 Activity

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

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

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

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

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

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

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

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools