我正面臨pageradapter和片段的問題。在PagerAdapter頁面上帶有片段的重複ID
我有一個PagerAdapter,並在每一頁上我想放一個片段。在頁面的XML佈局,我使用此代碼添加片段:
<fragment android:id="@+id/fragment1"
android:name="de.worldcup.android.ui.fragments.GroupTableFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
當我運行該應用程序,它當它試圖實例化的PagerAdapter的第二頁(第二時間instantiateItem方法是崩潰叫)在線,當我嘗試膨脹頁面的XML佈局。
View v = inflater.inflate(R.layout.group_activity_item, null);
錯誤:
03-15 21:57:34.795: E/AndroidRuntime(6257): Caused by: java.lang.IllegalArgumentException: Binary XML file line #20: Duplicate id 0x7f050043, tag null, or parent id 0x0 with another fragment for de.worldcup.android.ui.fragments.GroupTableFragment
我擡頭的ID 0x7f050043 - >這是@ + ID /片段1號。
任何想法如何解決這個問題?
謝謝:)