popupWindow在5.0版本以下不显示的问题

 
 

5.0之前必须设置宽高

在6.0版本以上直接使用setcontentview即可

另外一种解决办法是在xml布局中添加background图片

popupWindow.setContentView(listView);
popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);

猜你喜欢

转载自blog.csdn.net/zuola8579/article/details/79710831
今日推荐