MapActivity中的片段 [英] MapActivity in a fragment

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

问题描述

我有一个 FragmentActivity

public class parking extends FragmentActivity { }

它有3个标签,第二个和第三个表,解决了。

It has 3 tabs, the second and third are lists, solved.

public class tab2 extends Fragment{ }

但第一个是地图,所以,我不能扩展片段和 MapActivity

我该如何解决呢?

推荐答案

没有为MapFragment的支持,Android团队说的是做这个工作,由于Android 3.0。关于这里的问题更多信息<一个href="http://$c$c.google.com/p/android/issues/detail?id=15347&utm_source=buffer&buffer_share=acc72">http://$c$c.google.com/p/android/issues/detail?id=15347&utm_source=buffer&buffer_share=acc72 但是你可以做的是创造一个片段返回MapActivity。这里是一个code例子。由于inazaruk:<一href="https://github.com/inazaruk/examples/tree/master/MapFragmentExample">https://github.com/inazaruk/examples/tree/master/MapFragmentExample 它是如何工作:

There is no support for MapFragment, Android team says is working on it since Android 3.0. Here more information about the issue http://code.google.com/p/android/issues/detail?id=15347&utm_source=buffer&buffer_share=acc72 But what you can do is create a Fragment that returns a MapActivity. Here is a code example. Thanks to inazaruk: https://github.com/inazaruk/examples/tree/master/MapFragmentExample How it works:

  • MainFragmentActivity 是一个扩展FragmentActivity活动 并拥有两个MapFragments。
  • MyMapActivity 延伸MapActivity和 有图形页面。
  • LocalActivityManagerFragment 主机 LocalActivityManager。
  • MyMapFragment 扩展LocalActivityManagerFragment和TabHost帮助创建 MyMapActivity的内部实例。
  • MainFragmentActivity is the activity that extends FragmentActivity and hosts two MapFragments.
  • MyMapActivity extends MapActivity and has MapView.
  • LocalActivityManagerFragment hosts LocalActivityManager.
  • MyMapFragment extends LocalActivityManagerFragment and with help of TabHost creates internal instance of MyMapActivity.

如果您有任何疑问,请让我知道

if you have any doubt please let me know

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

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