FragmentActivity包含一个MapView的一个片段 [英] FragmentActivity with a Fragment Containing a MapView
问题描述
我知道有这样的但有几个问题我正在寻找的是稍有不同我看到它的方式。
I know there are a few questions like this but what I'm looking for is slightly different the way I see it.
问题
我有一个活动
,我永远只能去有一个活动
。
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
.
我已经顺利拿到了在 API级别3.0
和更大的这个工作。然而,问题开始时,我想去比这更低的使用兼容性库作为我这时就需要让我的活动
延长 FragmentActivity
获得片段
工作,然后我明显失去还扩展能力 MapActivity
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
问题
我如何使用兼容性支持库
,以便能够使用片段
和图形页面
相同活动中的
How can I use the Compatibility Support Library
to enable the use of Fragments
and a MapView
within the same Activity
?
任何帮助将大大AP preciated。
Any help would be greatly appreciated.
P.S 我个人认为这是荒谬的,他们并没有包括在此支持兼容性支持库
。
P.S I personally think it's ridiculous they didn't include support for this within the Compatibility Support Library
.
推荐答案
我做正是这一点!使用这个:
I've done exactly this! Using this:
https://github.com/petedoyle/android-support-v4-googlemaps
花了一些时间,但是这一点,我已经能够有片段和相同的活性下降到2.3内的图形页面(可能较低,以及)。你基本上从那个GitHub的网站,这是一个叫做Android支持-V4-R7-googlemaps.jar罐子和使用,而不是默认支持库。就这样,你的主要活动还延伸FragmentActivity(在后台延长MapActivity)。
It took some time, but with this, I've been able to have Fragments and a MapView inside the same Activity down to 2.3 (probably lower, as well). You basically get the jar from that github site, which is called android-support-v4-r7-googlemaps.jar, and use that instead of the default support library. With that, your main activity still extends FragmentActivity (which is extending MapActivity in the background).
应该有同样的链接,进一步方向的自述。
There should be a readme at that same link for further direction.
这篇关于FragmentActivity包含一个MapView的一个片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!