[英]Save fragments state in Navigation component
I am using new Navigation component of Jetpack Library
and it is pretty cool but i experience an annoying problem.我正在使用Jetpack Library
的新导航组件,它非常酷,但我遇到了一个烦人的问题。
I use Navigation component with Bottom navigation view and i have three fragments: Home, Profile and Settings.我使用带有底部导航视图的导航组件,我有三个片段:主页、配置文件和设置。 Home fragment has RecyclerView
and when user clicks an item from it, a new fragment appears.主页片段具有RecyclerView
并且当用户从中单击一个项目时,会出现一个新片段。 The problem is when i am in some state in Home fragment and go to for example profile fragment, this state is gone and new home fragment is created and i do not want this to happen.问题是当我在家庭片段中的一些 state 和 go 例如配置文件片段中时,这个 state 消失了,并且创建了新的家庭片段,我不想发生这种情况。
How can i solve this problem?我怎么解决这个问题?
Thanks in advance.提前致谢。
I think this issue exists in current navigation.我认为这个问题存在于当前的导航中。 In this year's dev summit they talked about fixing that issue.在今年的开发者峰会上,他们谈到了解决这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.