Multiple Map fragment in action bar tab

2019-08-19 07:31发布

Basically what i am trying to do is Tab1 -> Organisation Map Fragment Tab2 -> City Map

How should I go about doing this. I tried following some tutorials but it gives me the error "You are allowed to have single MapView in a MapViewActivity". Can some one please help me out

3条回答
我欲成王,谁敢阻挡
2楼-- · 2019-08-19 07:36

It's not possible to do this. As the message says, only one map per Activity.

查看更多
虎瘦雄心在
3楼-- · 2019-08-19 07:40

Google released the Map API Version 2. This finally allows to use a MapFragment and a SupportMapFragment. This allows adding Maps to ViewPagers and to Activities that do not extend MapActivity. It should also allow you to have multiple maps in one Activity

查看更多
地球回转人心会变
4楼-- · 2019-08-19 07:55

As Joe and the error message says, you can only have one mapview in a single activity.

What you could do (if you still want to use tabs) is just not change the fragment when the tab changes, and instead reload the map with different data.

查看更多
登录 后发表回答