2

I know there are a few questions like this but what I'm looking for is slightly different the way I see it.

THE PROBLEM

I have one Activity and I am only ever going to have one Activity.

I do however have multiple Fragments; one of which contains a MapView.

I have successfully got this working in API level 3.0 and greater. However, the problems start when I want to go lower than this using the compatibility library as I then need to make my Activity extend FragmentActivity to get Fragments to work and then I obviously lose the ability to also extend MapActivity

THE QUESTION

How can I use the Compatibility Support Library to enable the use of Fragments and a MapView within the same Activity?

Any help would be greatly appreciated.

P.S I personally think it's ridiculous they didn't include support for this within the Compatibility Support Library.

4

1 回答 1

3

我确实做到了这一点!使用这个:

https://github.com/petedoyle/android-support-v4-googlemaps

这花了一些时间,但是有了这个,我已经能够在同一个 Activity 中将 Fragments 和 MapView 降低到 2.3(也可能更低)。你基本上从那个 github 站点获取 jar,它被称为 android-support-v4-r7-googlemaps.jar,并使用它而不是默认的支持库。这样,您的主要活动仍会扩展 FragmentActivity(在后台扩展 MapActivity)。

在同一个链接上应该有一个自述文件以获取进一步的指导。

于 2012-08-06T14:11:35.173 回答