【问题标题】:FrameLayout$LayoutParams cannot be cast to WindowManager$LayoutParamsFrameLayout$LayoutParams 不能转换为 WindowManager$LayoutParams
【发布时间】:2016-07-26 17:17:31
【问题描述】:

我面临着下面这个链接中解释的类似问题。但是没有贴出解决方案。请帮忙解决。

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

【问题讨论】:

  • 如果您正在阅读链接的问题并仔细回答,您将获得解决方案 - 更改您的实施。例如使用DialogActivity

标签: android android-6.0-marshmallow android-popupwindow


【解决方案1】:

无需使用 DialogActivity。只需再添加一个 getParent() 即可访问容器。

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

【讨论】:

    猜你喜欢
    • 2016-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-05
    • 1970-01-01
    相关资源
    最近更新 更多