Android fragment在xml中使用没添加ID

Caused by: android.view.InflateException: Binary XML file line #24: Binary XML file line #24: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class fragment
Caused by: java.lang.IllegalArgumentException: Binary XML file line #24: Must specify unique android:id, android:tag, or have a parent with an id for xxx.xxxxx..XXXXFragment

原因是fragment在xml中使用没添加ID

Android fragment在xml中使用没添加ID_第1张图片

加上ID即可

Android fragment在xml中使用没添加ID_第2张图片

你可能感兴趣的:(Android)