参考:http://www.cnblogs.com/sw926/p/3230659.htmlhtml
注意:java
PopupWindow会给PopupView设置Padding,会致使ContentView的左右上下都会存在空隙。htm
解决以下:blog
在显示PopupWindow(即执行PopupWindow.showAtLocation())后,从新设置PopupView的padding。get
popupWindow.showAtLocation(x,x,x,x,); ViewGroup popupView = (ViewGroup) popupWindow.getContentView().getParent(); if (popupView != null) { popupView.setPadding(0, 0, 0, 0); }