gpt4 book ai didi

android - findViewById ClassCastExcpetion

转载 作者:搜寻专家 更新时间:2023-11-01 09:36:37 25 4
gpt4 key购买 nike

我正在使用 kotlin-extension 插件来查找 View 。

但现在我得到一个异常(exception)

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 并且它起作用了。

关于android - findViewById ClassCastExcpetion,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42650223/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com