簡體   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