Separate Back Stack for each tab in Android using Fragments

后端 未结 12 1014
南旧
南旧 2020-11-22 14:51

I\'m trying to implement tabs for navigation in an Android app. Since TabActivity and ActivityGroup are deprecated I would like to implement it using Fragments instead.

12条回答
  •  余生分开走
    2020-11-22 15:19

    This is a complex problem as Android only handles 1 back stack, but this is feasible. It took me days to create a library called Tab Stacker that does exactly what you are looking for: a fragment history for each tab. It is open source and fully documented, and can be included easily with gradle. You can find the library on github: https://github.com/smart-fun/TabStacker

    You can also download the sample app to see that the behaviour corresponds to your needs:

    https://play.google.com/apps/testing/fr.arnaudguyon.tabstackerapp

    If you have any question don't hesitate to drop a mail.

提交回复
热议问题