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

少し時間がかかりましたが、これにより、同じアクティビティ内にフラグメントとMapViewを2.3まで(おそらくそれよりも低く)することができました。基本的に、そのgithubサイト(android-support-v4-r7-googlemaps.jar)からjarを取得し、デフォルトのサポートライブラリの代わりにそれを使用します。それでも、メインアクティビティはFragmentActivityを拡張します(これはバックグラウンドでMapActivityを拡張します)。

さらなる方向性のために、同じリンクにreadmeがあるはずです。

于 2012-08-06T14:11:35.173 に答える