gpt4 book ai didi

android - 作为 ListView 行的 fragment (Google Maps Android API v2)

转载 作者:太空狗 更新时间:2023-10-29 15:14:31 27 4
gpt4 key购买 nike

以前,不可能在一个Activity中显示多个MapView,部分原因是我们不得不使用MapActivity来管理 View 。然而,随着最近发布的 Google Maps Android API v2 , 显示多个 map 是微不足道的。

在新的 API 中,有两种显示小部件的方法:使用 MapView 或使用 MapFragment。使用 fragment 被认为更容易,因为 View 要求开发人员转发所有生命周期方法。

我的应用程序要求将静态 map 显示为 ListView 的行。我最初打算使用 Static Maps API 来实现它并自己处理网络。然而,使用新的 map API 似乎会更有效率。

这引出了我的主要问题。是否可能/建议在 ListView 行中使用 fragment ?唯一相似post我发现并没有真正取得任何进展,但我认为现在我们可以嵌套 fragment ,这是可能的。

最佳答案

My application calls for static maps to be displayed as the rows of a ListView

这不太可能奏效,因为列表可能无法滚动,至少在用户不将 map 平移到其中一个极点时是这样。

Is it possible/advised to use fragments inside ListView rows?

这可能是不可能的。我当然不会建议它。 ViewPager 专门为自己的 PagerAdapter 避开了 ListAdapter,专门为了让在页面中使用 fragment 更加实用。

关于android - 作为 ListView 行的 fragment (Google Maps Android API v2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13810349/

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