private void showWinddowAbove(View view,int dra){
View contentView = LayoutInflater.from(getActivity()).inflate(
R.layout.poplay, null);
if(popupWindow == null){
popupWindow = new PopupWindow(contentView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
popupWindow.setFocusable(true);
popupWindow.setOutsideTouchable(true);
// 如果不设置PopupWindow的背景,有些版本就会出现一个问题:无论是点击外部区域还是Back键都无法dismiss弹框
popupWindow.setBackgroundDrawable(getResources().getDrawable(
R.drawable.circle_bg));
face_img = contentView.findViewById(R.id.face_img);
}
Glide.with(getActivity()).load(dra).into(face_img);
int[] location = new int[2];
view.getLocationOnScreen(location);
popupWindow.showAtLocation(view, Gravity.NO_GRAVITY, location[0], location[1] - popupWindow.g
Android:仿微信表情预览,popwindow的弹框位置
最新推荐文章于 2024-08-18 03:33:20 发布
本文详细介绍了在Android应用中如何仿照微信实现表情预览功能,重点讲解了如何自定义PopWindow并调整其弹出位置和距离,以满足不同场景的需求。
摘要由CSDN通过智能技术生成