解决方法:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { // Android 7.x中,PopupWindow高度为match_parent时,会出现兼容性问题,需要处理兼容性
int[] mLocation = new int[2];
stephenCommonTopTitleView.getTopTitleView().getLocationInWindow(mLocation);
int offsetY = mLocation[1] + stephenCommonTopTitleView.getTopTitleView().getHeight();
if (Build.VERSION.SDK_INT >= 25) { // Android 7.1中,PopupWindow高度为 match_parent 时,会占据整个屏幕
//故而需要在 Android 7.1上再做特殊处理
WindowManager wm = (WindowManager) activity.getSystemService(Context.WINDOW_SERVICE);
int screenHeight = wm.getDefaultDisplay().getHeight();
centWinShare.setHeight(screenHeight - offsetY); // 重新设置 PopupWindow 的高度
}
centWinShare.showAtLocation(stephenCommonTopTitleView.getTopTitleView(), Gravity.NO_GRAVITY, 0, offsetY);
} else {
centWinShare.showAsDropDown(stephenCommonTopTitleView.getTopTitleView());
} 思路大概是这样
/*if (Build.VERSION.SDK_INT != 24) {
//只有24这个版本有问题,好像是源码的问题
showAsDropDown(view);
} else {
//7.0 showAsDropDown没卵子用 得这么写
int[] location = new int[2];
view.getLocationOnScreen(location);
int x = location[0];
int y = location[1];
showAtLocation(view, Gravity.NO_GRAVITY, 0, y + view.getHeight());
//showAsDropDown(view, 0, marginTop);
}*/

最新文章

  1. xml 读取递归算法
  2. 分享50款 Android 移动应用程序图标【上篇】
  3. isScroll代码
  4. WCF服务中,[DataMember]属性标记的属性一定要有set访问器
  5. 【大数比较】NYOJ-73
  6. 符合web标准的网页下拉菜单
  7. ModSecurity CRS笔记[转]
  8. 【NOIP2015 DAY1 T3 】斗地主(landlords)
  9. python脚本对 mysql数据库进行增删改查操作
  10. bzoj3237(cdq+并查集)
  11. Spring Boot 自定义日志详解
  12. 【转载】Window服务器开机后一直处于蓝色屏幕(非蓝屏 crash)状态
  13. project 2013 工时完成百分比不会自动更新填充
  14. pytest 6 生成html报告
  15. Java程序在Linux上运行虚拟内存耗用很大
  16. oracle sql小结(主要讲横列转换的例子)group by以及wmsys.wm_concat()的使用
  17. (转)tomcat架构&session共享
  18. JS之事件机制
  19. LeetCode——Convert Sorted List to Binary Search Tree
  20. Material Design学习之 ProgreesBar

热门文章

  1. 关于DLNA
  2. SAP的战略企业管理功能介绍
  3. CentOS 6.8 安装 RabbitMQ
  4. 第三百三十二节,web爬虫讲解2—Scrapy框架爬虫—Scrapy使用
  5. linux vi命令详解2
  6. Windows 环境搭建Redis集群(win 64位)
  7. Windows 7运行命令大全
  8. 命令行编译C++程序
  9. Java编程思想学习笔记——复用类
  10. python unittest 2