bug -- android 7.0 popwindow显示位置异常情况解决
android 7.0 popwindow显示位置异常,在android7.1官方进行解决了,但是还是要多7.0的bug进行解决,我的解决方案里面通过重写popwindow进行适配:
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.widget.PopupWindow; /**
* 解决7.0 popwindow显示位置的问题
* Created by soyoungboy on 2017/3/16.
*/ public class FixPopWindow extends PopupWindow {
public FixPopWindow() {
} public FixPopWindow(View contentView) {
super(contentView);
} public FixPopWindow(View contentView, int width, int height) {
super(contentView, width, height);
} public FixPopWindow(View contentView, int width, int height, boolean focusable) {
super(contentView, width, height, focusable);
} public FixPopWindow(Context context) {
super(context);
} public FixPopWindow(Context context, AttributeSet attrs) {
super(context, attrs);
} public FixPopWindow(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
} public FixPopWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
} public FixPopWindow(int width, int height) {
super(width, height);
} @Override public void showAsDropDown(View anchorView) {
super.showAsDropDown(anchorView);
if (Build.VERSION.SDK_INT == 24) {
int[] a = new int[2];
anchorView.getLocationInWindow(a);
showAtLocation(anchorView, Gravity.NO_GRAVITY, 0, a[1] + anchorView.getHeight() + 0);
} else {
super.showAsDropDown(anchorView);
}
} @Override
public void showAsDropDown(View anchorView, int xoff, int yoff) {
if (Build.VERSION.SDK_INT == 24) {
int[] a = new int[2];
anchorView.getLocationInWindow(a);
showAtLocation(anchorView, Gravity.NO_GRAVITY, xoff,
a[1] + anchorView.getHeight() + yoff);
} else {
super.showAsDropDown(anchorView, xoff, yoff);
}
}
}
bug -- android 7.0 popwindow显示位置异常情况解决的更多相关文章
- Android 8.0 的部分坑及对应解决方法
虽然 Android 9.0 都已经面世了,本篇文章写的有点迟了. 但是迟到好过不到,因此基于此这边还是记录一下项目中遇到的 Android 8.0 的坑及对应解决方法. 每次系统升级,虽然系统功能更 ...
- android 6.0导航栏 NavigationBar影响视图解决办法
在开发app的时候会遇到有些测试手机没有物理按钮,比如最近在做的一个app在小米手机上运行显示效果很好,但是在华为P7手机上显示就乱了,底部的NavigationBar直接覆盖在主视图上,导致按钮无法 ...
- VS2010中GetMenu()和GetSubMenu(0)为NULL引发异常的解决方法 及添加方法
对于前面问题的分析:来源于http://blog.163.com/yuyang_tech/blog/static/216050083201211144120401/ 解决方法1: //来源:http: ...
- 关于Android 5.0 网络图标叹号的解决办法
那么下面就给出解决方法(无需root): 1.完全屏蔽网络检查功能,最简单快速,但是就没有办法提示wifi登录: adb shell "settings put global captive ...
- mysql如果搜索长度过宽 导致显示不全的情况解决
今天我在搜索数据库里面优惠码字段 直接使用 select * from table 的命令的时候 由于 第一个 字段过长导致后面的都无法显示全..我还是宽屏! 所以 搜索了一下 可以让 它单行显示 使 ...
- 关于linux上文件无法正确显示中文的情况解决
其实有遇到过多次,而且还有几次是css在预编译的时候,系统编码不对也会报错. 贴一个写的还不错的文章:http://www.360doc.com/content/11/0728/09/7102324_ ...
- android 8.0变更
Android 8.0 行为变更 Android 8.0 除了提供诸多新特性和功能外,还对系统和 API 行为做出了各种变更.本文重点介绍您应该了解并在开发应用时加以考虑的一些主要变更. 其中大部分变 ...
- Android用surface直接显示yuv数据(二)
上一篇文章主要是參照AwesomePlayer直接用SoftwareRenderer类来显示yuv,为了能用到这个类,不惜依赖了libstagefright.libstagefright_color_ ...
- Android 8.0 功能和 API
Android 8.0 为用户和开发者引入多种新功能.本文重点介绍面向开发者的新功能. 用户体验 通知 在 Android 8.0 中,我们已重新设计通知,以便为管理通知行为和设置提供更轻松和更统一的 ...
随机推荐
- could not launch process: decoding dwarf section info at offset 0x0: too short
Fabric调试异常 作者在使用chaincode进行智能合约开发的过程中,使用Goland + Golang + win10_X64作为开发环境: GoLand 2018.1.4 Build #GO ...
- Codeforces1101 | EducationalRound58 | 瞎讲报告
目录 Educational Codeforces Round 58 (Rated for Div. 2) A. Minimum Integer B. Accordion C. Division an ...
- 工程能力之C4模型
概述 刚在InfoQ上看到一篇介绍C4Model的文章,觉得这个模型设计的很赞,很有指导意义,做个简单的记录. Why,为什么需要架构图? ThoughtWorks中国 文章中有几句话我觉得很有道理, ...
- ipmitool命令详解
基础命令学习目录首页 原文链接:https://www.cnblogs.com/EricDing/p/8995263.html [root@localhost ~]# yum install -y i ...
- CF 1095C Powers Of Two(二进制拆分)
A positive integer xx is called a power of two if it can be represented as x=2y, where y is a non-ne ...
- Daily Scrum (2015/10/24)
由于这一天是周六,大家的学习热情依旧不是很高,但是在PM的要求和督促下,我们还是进行了一些工作.我们预计在明天(周日)完成全部的代码阅读工作,在下一周开始进行代码的编写工作,以下是我们的今日的工作情况 ...
- 结对编程-->总结报告
项目github地址 PSP时间表格 结对编程中关于Information Hiding, Interface Design, Loose Coupling原则的使用 Information Hidi ...
- 第二阶段Sprint冲刺会议7
进展:试着把视频录制功能加到时间提醒中,但是整合没有成功,今天没有进展.
- Java每日学习笔记1
单选按钮 JRadioButton radioButton1 = new JRadioButton("Java");// 创建单选按钮 contentPane.add(radioB ...
- 手机访问本地php项目遇到的问题及解决
做html5的本地应用要调试后台,学了下php 按照和连j2ee的时候一样,电脑发射wifi,ipconfig..等等 发现tomcat的可以访问,apache的不能访问,搜索好久,没找到解答, j ...