Unable to start activity ComponentInfo: Resource ID is not valid

今天写代码时出现了无法启动Activity的情况,

先报的Resource ID is not valid的错误,原因是我在setcontentview(R.layout.xxx)是写成了setcontenview(R.id.xxx).刚好,这个布局文件我给了一个同名的ID。

home_content_frame.xml文件

 "1.0" encoding="utf-8"?>

“http://schemas.android.com/apk/res/android”

android:id=<span class="str">"@+id/home_content_frame"</span>
android:layout_width=<span class="str">"match_parent"</span>
android:layout_height=<span class="str">"match_parent"</span> >

 

我想在代码中使用fragment来代替这个布局

getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.home_content_frame,mContent)
        .commit();

你可能感兴趣的:(Unable to start activity ComponentInfo: Resource ID is not valid)