SupportMapFragment相反MapFragment的 [英] SupportMapFragment Instead of MapFragment

查看:121
本文介绍了SupportMapFragment相反MapFragment的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打一个使用谷歌地图Android版V2 Android应用程序。

我可以显示地图。我甚至可以浏览和缩放。但是,当我想寻找更多操作之作,我找不到任何。

我想这个应用程序工作在API级别8及以上。所以,我用 SupportMapFragment 。我听说,如果我想让我的应用程序工作在API级别8以上,我必须使用 SupporMapFragment

我发现约 MapFragment 取值的例子,但不幸的是,不是关于 SupportMapFragment

我希望让这些操作的工作在我的应用程序,但是,他们使用 MapFragment

一个

两个

有没有做这样的事情,加标记的一种方式,显示我的当前位置和走,我点击的点位? (使用 SupportMapFragment ,当然。)

非常感谢你了。

解决方案
  

有没有做这样的事情,加标记的一种方式,显示我的当前位置和走,我点击的点位? (当然使用SupportMapFragment。)

是的。

步骤#1:添加了支持Android包到您的应用程序

步骤#2:让你的活动从 FragmentActivity 继承了Android支持包

第三步:将所有 MapFragment 引用(Java的code和布局的XML资源) SupportMapFragment

和你就大功告成了。

所有我的地图V2样品使用 SupportMapFragment ,与ActionBarSherlock结合(这就是为什么你会看到 SherlockFragmentActivity ,而不是 FragmentActivity

I want to make an android application that uses Google Maps for Android v2.

I can show a map. I can even navigate and zoom. But, when I want to search for more operations to make, I can't find any.

I want this application to work on API level 8 and above. So, I used SupportMapFragment. I heard that, if I want to make my application to work on API level 8 and above, I have to use SupporMapFragment.

I found examples about MapFragments, but unfortunately, not about SupportMapFragment.

I want to make these operations work in my application, however, they're using MapFragment:

One

Two

Is there a way of doing things like, "add marker", "show my current location", and "take position of the point that I clicked"? (using SupportMapFragment, of course. )

Thank you very much already.

解决方案

Is there a way of doing things like, "add marker", "show my current location", and "take position of the point that I clicked"? (using SupportMapFragment, of course. )

Yes.

Step #1: Add the Android Support package to your app.

Step #2: Have your activities inherit from FragmentActivity from the Android Support package.

Step #3: Change all MapFragment references (Java code and layout XML resources) to SupportMapFragment.

And you're done.

All of my Maps V2 samples use SupportMapFragment, in conjunction with ActionBarSherlock (which is why you will see SherlockFragmentActivity as opposed to FragmentActivity.

这篇关于SupportMapFragment相反MapFragment的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆