简体   繁体   中英

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. 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).

Is there any way to pre-load fragments and improve transitions?

Thanks in advance !


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.

Might also work for higher versions than 2.3.4. I haven't checked yet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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