Android M ClassCastException: FrameLayout$LayoutParams cannot be cast to WindowManager$LayoutParams

后端 未结 2 1487
时光取名叫无心
时光取名叫无心 2020-12-16 07:58

This piece of code works seems to work in android api 16 - 22 but does not work in api 23. I\'m simply trying to display a popupwindow with options in it and dim the backgro

2条回答
  •  伪装坚强ぢ
    2020-12-16 08:44

    Just add one more .getParent() to access the container.

     if (android.os.Build.VERSION.SDK_INT > 22) {
                container = (View) pwindow.getContentView().getParent().getParent();
            }else{
                container = (View) pwindow.getContentView().getParent();
            }
    

提交回复
热议问题