gpt4 book ai didi

android - 如何在滑动菜单中使用 Android Google Map V2 作为 fragment ?

转载 作者:行者123 更新时间:2023-11-29 01:54:53 24 4
gpt4 key购买 nike

我在 ActionBarSherlock 中使用滑动菜单,需要在 fragment 中显示 android google map v2。该类扩展了 SherlockFragment。我该怎么办?

最佳答案

最好的方法是扩展 SupportMapFragment 并在那里执行所有逻辑。

然后您可以使用 FragmentPagerAdapter 将此 fragment 简单地添加到 ViewPager 中,数据集为:

class FrgInfo {
Class clss;
Bundle args;
}

并覆盖 getItem 方法:

@Override
public Fragment getItem(final int position) {
final FrgInfo info = fragments.get(position);
return Fragment.instantiate(context, info.clss.getName(), info.args);
}

这应该可以解决问题。

关于android - 如何在滑动菜单中使用 Android Google Map V2 作为 fragment ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15769648/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com