popupwindow在android7.0出现全屏解决方案
来源:互联网 发布:怎么设定网络熟读 编辑:程序博客网 时间:2024/06/01 08:13
在android7.0的版本测出popupwindow使用showAsDropDown方法之后,并不能显示在指定view的下方,而是全屏显示,只要重写showAsDropDown判断一下版本就好了.建议不要使用popupwindow了,使用DialogFragment代替,官方推荐的不要问为什么.
public class SingleFlowPopuwindow extends PopupWindow { public SingleFlowPopuwindow (View contentView, int width, int height){ super(contentView,width,height); } @Override public void showAsDropDown(View anchor) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { Rect visibleFrame = new Rect(); anchor.getGlobalVisibleRect(visibleFrame); int height = anchor.getResources().getDisplayMetrics().heightPixels - visibleFrame.bottom; setHeight(height); } super.showAsDropDown(anchor); } @Override public void showAsDropDown(View anchor, int xoff, int yoff) { if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { Rect visibleFrame = new Rect(); anchor.getGlobalVisibleRect(visibleFrame); int height = anchor.getResources().getDisplayMetrics().heightPixels - visibleFrame.bottom; setHeight(height); } super.showAsDropDown(anchor, xoff, yoff); }}
阅读全文
0 0
- popupwindow在android7.0出现全屏解决方案
- popupWindow在android7.0以上显示全屏的问题
- android7.0-PopupWindow-showAsDropDown
- 解决PopupWindow在android7.0弹出位置错误问题
- Android7.0 popupwindow showAsDropDown在屏幕上方弹出解决方法
- PopupWindow在Android7.0后不能显示到指定位置
- PopupWindow在android7.0+的update、showAsDropDown方法
- 安装APK在android7.0以下版本出现INSTALL_PARSE_FAILED_NO_CERTIFICATES错误的解决方案
- Android7.0 PopupWindow的兼容问题
- PopupWindow的showAsDropDown位置问题 Android7.0
- Android7.0中文文档(API)-- PopupWindow
- Android7.0 popupwindow位置错误解决办法
- Android7.0 popupWindow显示位置的问题
- PopupWindow在Android7.0和7.1系统上显示位置不正确的问题解决
- Android7.0中PopupWindow弹出位置异常问题
- 解决android7.0popupwindow弹出框位置不正确的问题
- [问题解决]Android7.0上PopupWindow的showAsDropDown位置问题
- Android7.0中关于popupWindow的bug解决办法
- Java并发编程基础
- Python使用datetime模块进行简单的日期换算与计算
- java多线程[6]:CountDownLatch
- Android移动开发-蓝牙(BlueTooth)设备检测连接的实现
- JSP
- popupwindow在android7.0出现全屏解决方案
- 类加载器&注解&动态代理
- 原生JS获取当前时间
- web笔记二:Tomcat的使用
- mysql5.7在windows7下my.ini文件加载路径及数据位置修改
- 【干货#016】小程序后端Bmob入门:获取第一行数据
- 《数据库系统概念》13-索引
- 字符串有关(BIF)
- 数据规整