Best way to implement tabs with lists, fragments and maps?

放肆的年华 提交于 2019-12-23 17:43:43

问题


I'm trying to "port" an iOS app to Android. The original iOS app workflow is:

Tab 1
  List1 -> Detail -> DetailMap

Tab 2
  List2 -> Detail -> DetailMap

Tab 3
  Map -> Detail

Where "List1" and "List2" are lists of places, "Detail" shows info about a place, "DetailMap" shows where the place is on the map. "Map" is a simple map with markers the user can click to reach "Detail".

What's the best way to implement this workflow in Android?

I know I should avoid using a TabActivity (deprecated), and instead use an action bar and fragments to provide navigation tabs. Ok, but then how to implement navigation from "List1" to "Detail", and from "Detail" to "DetailMap"? I don't think it's possible to have fragments inside a fragment?

And what about the maps? I don't think it's possible to have a mapview inside a fragment, right?

I must be missing something (maybe a lot)...


回答1:


One of the best components for this is the ViewPager. http://tamsler.blogspot.com/2011/10/android-viewpager-and-fragments.html

and

http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html

You can see it in action in the new Android Market, or the Google+ App for Android.



来源:https://stackoverflow.com/questions/8566566/best-way-to-implement-tabs-with-lists-fragments-and-maps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!