5.0之前必须设置宽高
在6.0版本以上直接使用setcontentview即可
另外一种解决办法是在xml布局中添加background图片
popupWindow.setContentView(listView); popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
5.0之前必须设置宽高
在6.0版本以上直接使用setcontentview即可
另外一种解决办法是在xml布局中添加background图片
popupWindow.setContentView(listView); popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);