Android:WindowManager.addView Unable to add window -- token null is not valid;

在使用WindowManager.addView时报错:

android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?

这个问题和适配8.0有关,需要把WindowManager.LayoutParams的type设置为WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY

猜你喜欢

转载自blog.csdn.net/qq_27454233/article/details/107338632