gpt4 book ai didi

android - 使用导航架构时如何设置 `setReorderingAllowed`?

转载 作者:行者123 更新时间:2023-12-04 23:49:59 60 4
gpt4 key购买 nike

在使用导航架构时推迟 fragment 的进入转换时,图中的“主页” fragment 可见一微秒。谷歌搜索了一下,文档告诉我设置 setReorderingAllowed(true)在 fragmentManager 上优化此流程。但是,文档不使用导航架构组件。
setReorderingAllowed(true)以及在使用导航架构组件时如何实现它?

最佳答案

setReorderingAllowed(true)使用 naivate() 时自动设置.见 FragmentNavigator执行:

    public NavDestination navigate(@NonNull Destination destination, @Nullable Bundle args,
@Nullable NavOptions navOptions, @Nullable Navigator.Extras navigatorExtras) {

// OTHER CODE
// OTHER CODE

ft.setReorderingAllowed(true);
ft.commit();
// The commit succeeded, update our view of the world
if (isAdded) {
mBackStack.add(destId);
return destination;
} else {
return null;
}
}

关于android - 使用导航架构时如何设置 `setReorderingAllowed`?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63558730/

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