Multiple maps v2 in TabActivity

后端 未结 2 590
终归单人心
终归单人心 2020-12-28 08:42

I\'m currently trying to have 2 maps v2 in different tabs of a TabActivity using MapView objects. The problem arises in the following scenario:

  • tab1 with a map
2条回答
  •  一向
    一向 (楼主)
    2020-12-28 09:26

    I ran into the same issue a few days ago and was pulling my hair out over what to do.

    Originally I had my app set up with "Tabs the Fragment way" as seen here to avoid the deprecated TabActivity, and used this hack to allow me to incorporate Maps v1 in with the Fragments. It basically just masks an Activity as a Fragment.

    But then switched to TabActivity further down the track for simplicity / it was better suited for the whole app. But now obviously this 2x Maps v2 fragment problem has become an issue..

    So I have reverted back to "Tabs with Fragments" and just have the "hack setup" as mentioned above for each tab, which allows to have an Activity for each tab, AND having more than one Maps v2 displaying for each Tab. I haven't gone into too much depth with it, but it seems to be doing the job atm, with having just thrown some code together to test it out..

    Don't know if you're still having an issue with this / this obviously isn't the most correct solution, but just thought I'd share my two cents incase you still needed it.

    Cheers.

提交回复
热议问题