布局错误:
The layout <layout> in layout has no declaration in the base layout folder; this can lead to crashes when the resource is queried in a configuration that does not match this qualifier
解决方法:File - Invalidate caches/Restart - Invalidate and Restart
popwindon、dialog弹出Activity窗口不存在:
unable to add window -- token null is not valid; is your activity running 错误解决办法
解决办法:
使用onWindowFocusChanged(boolean hasFocus)的时机显示
结合延迟使用:
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (inputBoardService != null&&!isFinishing()) {
inputBoardService.setKeyboardBackgroud();
}
}
// 延迟加载popupwindow,如果不加延迟就会报错
view.postDelayed(new Runnable() {
@Override
public void run() {
showAtLocation(view, Gravity.NO_GRAVITY, 0, 0);
}
},15);