谷歌地图api v2的几个片段

时间:2014-03-13 20:30:42

标签: android google-maps android-viewpager

我需要使用包含com.google.android.gms.maps.SupportMapFragment

的Fragment制作FragmentPagerAdapter
FragmentPagerAdapter:

    @Override
    public Fragment getItem(int position) {
        return TargetFragment.getInstance(tasks.getTaskList().get(position));
    }

TargetFragment布局:

...
        <fragment
            android:id="@+id/mapView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:name="com.google.android.gms.maps.SupportMapFragment"
            android:layout_margin="5dp" />

    </LinearLayout>

</LinearLayout>

但如果我有多个TargetFragment,我会收到错误

IllegalArgumentException: Binary XML file line #119: Duplicate id 0x7f080073, tag null, or parent id 0x0 with another fragment for com.google.android.gms.maps.SupportMapFragment

0 个答案:

没有答案