java - 为什么 Android Jetpack 底部导航组件这么卡?
问题描述
我在我的应用程序中使用 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 秒,直到片段出现。是否有任何解决滞后的方法?
解决方案
我有同样的问题。执行加载动画和加载内容时,它似乎与动画有关recyclerview
。我确实延迟了recyclerview
一些毫秒的人口,但这不是一个好的解决方案
推荐阅读
- python - Django:models.BooleanField(default=False) 总是将值保存为 1(True)
- android - Android studio + Firebase - 无法写入数据
- c++ - Google Kickstart 2013 Round B Problem Sudoku Checker 给出了错误的答案,但它正在运行
- jquery - 使用 Nivo-Slider jquery 插件循环遍历数组以显示图像
- python - 发送 gzip 数据而不解压缩
- kubernetes - 将 GPU 与 Kubernetes GKE 和节点自动配置一起使用
- ios - 单元测试,测试一个视图控制器是否已经呈现了另一个视图控制器
- r - 如何将数字转换为R中的日期和时间戳?
- python - Gensim:以字符串作为输入而不是字符串列表的单词移动距离
- javascript - 如何将承诺的返回值分配给变量?