android入坑

72 阅读1分钟

android中的fragment使用中出现“Error inflating class fragment”

在引入fragment的地方,需要加id

<fragment
    android:id="@+id/fragment"
    android:name="com.example.hgoboxtest.fragment.ScanSearchFragment"
    android:layout_width="wrap_content"
    android:layout_height="match_parent" />

android:id="@+id/fragment"不定义就会报错