android 7.0 PopupWindow bug修复,测试没啥问题
2017-03-09 18:43
302 查看
View view = LayoutInflater.from(this).inflate(R.layout.xxx, null); popupWindow = new PopupWindow(view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, true) { @Override public void showAsDropDown(View anchor) { Class<?> popupwindow = PopupWindow.class; try { Method m2 = popupwindow.getDeclaredMethod("computeGravity"); m2.setAccessible(true); int invoke = (int) m2.invoke(popupWindow); int gravity = Gravity.START | Gravity.TOP; if (invoke == gravity) { Rect rect = new Rect(); anchor.getGlobalVisibleRect(rect); int h = anchor.getResources().getDisplayMetrics().heightPixels - rect.bottom; setHeight(h); } } catch (Exception e) { e.printStackTrace(); } super.showAsDropDown(anchor); } }; popupWindow.setBackgroundDrawable(new BitmapDrawable()); popupWindow.showAsDropDown(dropView);
相关文章推荐
- Android PopupWindow在7.0中弹出位置问题
- android popupwindow在7.0 7.1上的问题
- PopupWindow 在 Android N(7.0) 的兼容性问题
- Android PopupWindow在7.0中弹出位置问题
- android popupwindow 小问题
- Android PopupWindow with ListView的一些问题
- PopupWindow 适配 Android 7.0 、7.1
- 解决android 7.0 popwindow的showAsDropDown没有效果问题
- Android开发之旅一PopupWindow写的一个基类和PopupWindow中EditText输入法的问题
- Android 7.1 PopupWindow适配问题
- Android Popupwindow使用问题
- Android PopupWindow 与 软键盘 的遮挡问题解决
- [置顶] Android 7.0 调用系统拍照,相册,剪裁,修复拍照图片旋转问题
- android之PopupWindow焦点问题
- android popupwindow showAsDropDown offsetx无效的问题
- MVP模式的Android 调用系统拍照,相册,剪裁,适配到7.0,修复拍照图片旋转问题
- android 7.0 PopupWindow中ShowAsDropDown()方法不适配的解决方案
- android popupWindow 在android 7.0上显示缺陷
- 解决android 7.0 popwindow的showAsDropDown没有效果问题
- Android PopupWindow悬浮弹框使用及解决back键点击不消失的问题