简体   繁体   English

Android Jetpack 导航组件太慢。 有什么问题?

[英]Android Jetpack Navigation Component too slow. What's the problem?

Today I was changing from ViewPager to Navigation Component (with Bottom Navigation View ) on my Android project.今天,我在 Android 项目中从ViewPager更改为Navigation Component (带有Bottom Navigation View )。 The problem is that, when using ViewPager all is fast as lightning but using Navigation Component it's very laggy (2 seconds later after you pressed the view appears and specially with RecyclerView fragments).问题是,当使用ViewPager时,一切都快如闪电,但使用Navigation Component它非常滞后(按下视图 2 秒后出现,特别是RecyclerView片段)。

Is there any way to pre-load fragments and improve transitions?有什么方法可以预加载片段并改善过渡?

Thanks in advance !提前致谢 !


MainActivity.java MainActivity.java

NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupWithNavController(binding.bottomBar, navController);

I too had the same issue.我也有同样的问题。 I believe its a bug in their latest dependency.我相信这是他们最新依赖中的一个错误。

Changing to androidx.navigation:navigation-fragment-ktx:2.3.4 and androidx.navigation:navigation-ui-ktx:2.3.4 solved my issue.更改为androidx.navigation:navigation-fragment-ktx:2.3.4androidx.navigation:navigation-ui-ktx:2.3.4解决了我的问题。

Might also work for higher versions than 2.3.4.也可能适用于高于 2.3.4 的版本。 I haven't checked yet.我还没有检查。

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

相关问题 为什么 Android Jetpack 底部导航组件如此滞后? - Why Android Jetpack Bottom Navigation Component is so laggy? Android - 喷气背包导航 - Android - Jetpack Navigation saveAll() 太慢了。 使用 Spring 启动的 Cassandra 数据库。 为什么? - saveAll() is too slow. Cassandra Database with Spring boot. why? 我的Listview太慢了。 并在向上滚动时崩溃 - My Listview is too slow. and crashes while scrolling up 搜索后使用 RandomAccessFile 的 JAVA 非常慢。 是什么原因? - JAVA using RandomAccessFile after seek is very slow. What is the reason? weka.attributeSelection.InfoGainAttributeEval太慢。 关于如何加快速度的任何想法? - weka.attributeSelection.InfoGainAttributeEval is too slow. Any ideas on how to speed it up? 从Java调用Python函数(没有Jython,因为它太慢了。) - Calling Python Functions from Java (Without Jython, because it is too slow.) 如何在android java中使用带有bottomNavigationView的jetpack导航 - How to use jetpack navigation with bottomNavigationView in android java 带导航视图的导航组件 android - navigation component with navigation view android Android SQLite查询太慢 - Android SQLite querys are too slow
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM