findViewById ClassCastExcpetion
findViewById ClassCastExcpetion
我正在使用 kotlin-extension 插件来查找视图。
但现在我得到一个例外
setSupportActionBar(mainActivity_toolbar)
它一直有效到现在,但现在它给出了一个
ClassCastException: android.widget.FrameLayout cannot be cast to android.support.v7.widget.Toolbar
我做的最后一件事是为我的 fab 添加一个 id 并设置一个 OnClickListener
。
但是在我的 layout.xml:
android.support.v7.widget.Toolbar
的 ID "@+id/mainActivity_toolbar"
FrameLayout
的 ID 为 "@+id/mainActivity_framelayout"
.
我最初以为 kotlin-extension 插件中有一个错误,但是 findViewById
它也不起作用。
谢谢
重启 IntelliJ 解决了我的问题。
没想到,只重建了我的项目,但没有帮助。
由于这个 Post,我认为这可能是我的问题,所以因为重建没有帮助,我重新启动了 IntelliJ,它起作用了。
我正在使用 kotlin-extension 插件来查找视图。
但现在我得到一个例外
setSupportActionBar(mainActivity_toolbar)
它一直有效到现在,但现在它给出了一个
ClassCastException: android.widget.FrameLayout cannot be cast to android.support.v7.widget.Toolbar
我做的最后一件事是为我的 fab 添加一个 id 并设置一个 OnClickListener
。
但是在我的 layout.xml:
android.support.v7.widget.Toolbar
的 ID "@+id/mainActivity_toolbar"
FrameLayout
的 ID 为 "@+id/mainActivity_framelayout"
.
我最初以为 kotlin-extension 插件中有一个错误,但是 findViewById
它也不起作用。
谢谢
重启 IntelliJ 解决了我的问题。
没想到,只重建了我的项目,但没有帮助。
由于这个 Post,我认为这可能是我的问题,所以因为重建没有帮助,我重新启动了 IntelliJ,它起作用了。