在使用Popup Window时候,一般都会遇到: Unable to add window -- token null is not valid。 一般给出的解决方案是延时几百毫秒。 我遇到的问题是延时了1秒种还不行。其实界面都显示了 Activity onresume也走了。 但是很怪的是:getWindowToken()一直为null. 最后直接用 window.getDecorView()() 来替换 mPopupWindow.showAtLocation(mWindow.getDecorView(), Gravity.CENTER, 0, 0); 目前还没发现什么问题。先这样解决吧