我正在使用基于 Fragment
的应用程序,需要使用 Google Maps API v2 来显示 map 。我正在尝试将 SupportMapFragment
放入 ListView
header 中,但不确定如何实现。
我已尝试创建 fragment 的 newInstance
并调用 getView
将其设置为 headerView,但 getView
返回 null。
这行不通:
SupportMapFragment s = SupportMapFragment.newInstance();
list.addHeaderView(s.getView());
谢谢。
最佳答案
通过在自己的 xml 文件中定义 fragment 、扩充该 View 并将其添加为标题 View 使其工作。
关于android - ListView header 中的 SupportMapFragment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15429102/