首页 > 代码库 > 7.0手机后popupWindow 的showAtLocation()和showAsDropDown()
7.0手机后popupWindow 的showAtLocation()和showAsDropDown()
手机系统7.0后用showAsDropDown()会位置异常,这是用showAtLocation()就好了。
if (Build.VERSION.SDK_INT < 24) {//在7.0之前
pw.showAsDropDown(ll_rank, 0, 0);//ll_rank是一个view,表示显示在下方
} else {
// 适配 android 7.0
int[] location = new int[2];
re_hotel_address.getLocationOnScreen(location);//re_hotel_address是一个view,表示显示在她的上方
int x = location[0];
int y = location[1];
pw.showAtLocation(re_hotel_address, Gravity.NO_GRAVITY, 0,y);
}
7.0手机后popupWindow 的showAtLocation()和showAsDropDown()
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。