繁体   English   中英

为什么 Android Jetpack 底部导航组件如此滞后?

[英]Why Android Jetpack Bottom Navigation Component is so laggy?

我在我的应用程序中使用 android 底部导航组件。 正如我的 MainActivity 上的这些行:

BottomNavigationView navView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
                R.id.navigation_home,
                R.id.navigation_product,
                R.id.navigation_setting
).build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
NavigationUI.setupWithNavController(navView, navController);

ProductFragment 中有 2 个选项卡使用 viewpager,每个选项卡从服务器加载 REST API 并绑定到 Recyclerview。 我发现每次我导航到 Product 时,它都会延迟大约 2 秒,直到片段出现。 有什么解决滞后的方法吗?

我有同样的问题。 加载 animation 时似乎与 animation 有关,执行和内容加载如recyclerview 我确实将recyclerview的人口推迟了一些毫秒,但这不是一个好的解决方案

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM