Android7.0上PopupWindow的showAsDropDown位置问题
2017-04-14 20:31
549 查看
Rect rect = new Rect(); anchor.getGlobalVisibleRect(rect); int h = anchor.getResources().getDisplayMetrics().heightPixels - rect.bottom; setHeight(h);
问题说明
我的popupWindow是用来展示listView的,近期在Android7.0手机上测试发现showAsDropDown(view)展示时发现会充满屏幕,而不是展示在
view的下方,测试发现在7.0以下和7.1系统下都没有类似问题。
问题解决
重写showAsDropDown(view),如下:
@Override public void showAsDropDown(View anchor) { if(Build.VERSION.SDK_INT == 24) { Rect rect = new Rect(); anchor.getGlobalVisibleRect(rect); int h = anchor.getResources().getDisplayMetrics().heightPixels - rect.bottom; setHeight(h); } super.showAsDropDown(anchor); }1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
相关文章推荐
- Android7.0上PopupWindow的showAsDropDown位置问题 参数无效
- [问题解决]Android7.0上PopupWindow的showAsDropDown位置问题
- Android7.0上PopupWindow的showAsDropDown位置问题
- Android7.0版本 PopupWindow.showAsDropDown() 白屏无效问题
- Android7.0 popupWindow显示位置的问题
- android popupwindow showAsDropDown offsetx无效的问题
- Android7.0 7.1 popupwindow showAsDropDown 显示异常解决办法
- 解决android7.0 popwindow设置showAsDropdown不显示在控件下方的问题
- 【Android 非常基础】PopupWindow showAtLocation和showAsDropDown参数分析
- Android PopupWindow在7.0中弹出位置问题
- 解决android 7.0 popwindow的showAsDropDown没有效果问题
- PopupWindow showAtLocation和showAsDropDown参数分析
- 屏幕旋转时调用PopupWindow update方法更新位置失效的问题及解决方案
- Android PopupWindow在7.0中弹出位置问题
- PopupWindow showAtLocation和showAsDropDown参数分析
- 【Android 非常基础】PopupWindow showAtLocation和showAsDropDown参数分析
- Android编程之PopupWindow隐藏及显示方法示例(showAtLocation,showAsDropDown)
- PopupWindow的showAsDropDown位置问题 Android7.0
- window的showAsDropDown失效的问题
- Android PopupWindow()中 showAsDropDown()弹出位置异常问题