问题
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