ActionBarSherlock +谷歌地图API V2重复ID [英] ActionBarSherlock + Google Maps API v2 Duplicate Id

查看:167
本文介绍了ActionBarSherlock +谷歌地图API V2重复ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图整合与谷歌地图API V2碎片ActionBarSherlock。

I'm trying to integrate the ActionBarSherlock with Google Maps API v2 fragments.

我有2片段的布局:一个用于列表布局,另外一SupportMapFragment

I have a layout with 2 fragments: one for a list layout and another with a SupportMapFragment.

当我点击一个列表项第一顺利,但是当我点击一个列表项第二次,它抛出一个错误:重复ID 0x7f040038,标记为空,或父ID为0x0与另一个片段com.google.android .gms.maps.SupportMapFragment

When I click on a list item first go well but when I click on a list item second time, it throws an error: " Duplicate id 0x7f040038, tag null, or parent id 0x0 with another fragment for com.google.android.gms.maps.SupportMapFragment"

我试了几种解决方案,其中没有一个已经能够解决它。有什么我做错了吗?请帮助我!

I tried several solutions and none of them have been able to fix it. Is there something I'm doing wrong? Please help me!!

我修改ActionBarSherlock包括SherlockMapFragment实施,以支持新的SupportMap(如下所示: https://gist.github.com/4392030 )。

I modified ActionBarSherlock to include SherlockMapFragment implemented to support the new SupportMap (as shown here: https://gist.github.com/4392030).

这是我的code: <一href="https://github.com/inigo-jimenez/TestGoogleMaps">https://github.com/inigo-jimenez/TestGoogleMaps

推荐答案

这是不符合ActionBarSherlock一个问题,但更广泛的之一,当你已经SupportMapFragment您定制的片断中。

This is not a problem with ActionBarSherlock, but a broader one when you have SupportMapFragment inside your custom fragment.

您需要使用getChildFragmentManager()添加SupportMapFragment,而不是通过XML。

You need to use getChildFragmentManager() to add SupportMapFragment and not through xml.

看看我的答案在这里: MapFragment的片段,替代

Take a look at my answer here: MapFragment in Fragment, alternatives?

这篇关于ActionBarSherlock +谷歌地图API V2重复ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆