Android:IllegalArgumentException:两个视图在层次结构中具有相同的ID

时间:2019-04-07 18:47:54

标签: java android

我知道如果您对两个视图使用相同的ID,则可能会发生此错误。 但是,就我而言,我将视图的ID更改了3次以使用不同的名称。 在项目中搜索了重复的ID,没有具有该ID的视图。 当我打开应用程序时,仍然会发生这种情况。 我也重建了项目。

有什么建议吗?

java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.myapp.test/com.myapp.test.MainActivity}: java.lang.IllegalArgumentException: Wrong state class, expecting View State but received class android.support.design.stateful.ExtendableSavedState instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/fab_main_rs. Make sure other views do not use the same id.

1 个答案:

答案 0 :(得分:-1)

我相信您在ID定义前面缺少+

即。而不是android:id="id/fab_main_rs",您应该拥有android:id="@+id/fab_main_rs"

相关问题