使用PopupWindow实现Menu功能

参考:http://www.cnblogs.com/sw926/p/3230659.html

注意:

PopupWindow会给PopupView设置Padding,会导致ContentView的左右上下都会存在空隙。

解决如下:

在显示PopupWindow(即执行PopupWindow.showAtLocation())后,重新设置PopupView的padding。

popupWindow.showAtLocation(x,x,x,x,);
ViewGroup popupView = (ViewGroup) popupWindow.getContentView().getParent();
if (popupView != null) {
    popupView.setPadding(0, 0, 0, 0);
}

 

posted @ 2015-03-06 09:28  zhangze  阅读(738)  评论(1编辑  收藏  举报