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插件中有一个bug,但是使用findViewById
也是行不通的。
谢谢
重新启动IntelliJ解决了我的问题。
没有想到,只重建了我的项目,并没有帮助。
由于这个职位 ,我认为这可能是我的问题,因为重建dosn't帮助,我重新启动IntelliJ,它的工作。