Why Android Jetpack Bottom Navigation Component is so laggy?

Viewed 344

I'm using android bottom navigation component in my app. As these lines on my 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);

There are 2 tabs inside ProductFragment using viewpager and each tabs load REST API from the server and bind to Recyclerview. I found that everytime I navigate to Product it has about 2 seconds lag until the fragment showed up. Is there any work around for the lag ?

1 Answers

I'm having the same problem. It seems something to do with the animation when loading animation is execute and content loading like recyclerview. I did delay the population of the recyclerview some milisecs but that's not a good solution

Related