同样的代码,在华为手机中没出现这个问题,但在Vivo X7上,PopupWindow确死活弹不出来,logcat中又没有错误提示。以下是PopupWindow中必须设置的:
setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
setFocusable(true);
setBackgroundDrawable(new BitmapDrawable());
我是由于没有写setHeight,所以在某些手机上,PopupWindow弹不出来