有人知道 popwindoew 在 7.0 8.0 9.0 手机 弹出的位置异常 怎么适配吗?

Write_BUG小能手 初级 2019-04-29 02:04:35
有人知道 popwindoew 在 7.0 8.0 9.0 手机 弹出的位置异常 怎么适配吗? 网上都是

if (Build.VERSION.SDK_INT >= 24){
Rect visibleFrame = new Rect();
relayView.getGlobalVisibleRect(visibleFrame);
int height = relayView.getResources().getDisplayMetrics().heightPixels - visibleFrame.bottom;
popupWindow.setHeight(height);
popupWindow.showAsDropDown(relayView,0,0);
}else {
popupWindow.showAsDropDown(relayView,0,0);
}

这样的解决方法,这只能解决7.0 弹出错位 ,8.0 9.0 的时候弹窗的底部透明遮罩,有一部分空白!!
请问这个问题怎么解决呢?
...全文
88 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Write_BUG小能手 初级 2019-04-30
  • 打赏
  • 举报
回复
我的问题已经解决了 ,需要再加上虚拟键的高度
TomCat0916 2019-04-29
  • 打赏
  • 举报
回复
建议附一张问题效果图,比较容易获得你想要的答案。 另:建议使用去showAtLocation(View parent, int gravity, int x, int y)方法显示popupWindow

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧