小编ron*_*eno的帖子

Android Paging 3 不显示 Loadstate Adapter

我已经按照教程将 Loadstate Adapter 添加到 Android Paging 3 上的 Recyclerview Adapter 但目前,它没有显示。这就是我更新适配器的方式。

 lifecycleScope.launch {
            viewModel.searchProducts(searchParam, channelId, categoryId)
                .collectLatest {
                    binding.allProductRecyclerView.isVisible = true
                    adapter.submitData(it)
                }
        
Run Code Online (Sandbox Code Playgroud)

这就是我添加 LoadState 适配器的方式

  binding.allProductRecyclerView.adapter = adapter.withLoadStateFooter(
        footer = ProductLoadingStateAdapter()
    )
Run Code Online (Sandbox Code Playgroud)

这是 LoadStateAdapter 的要点也是Activity Layout加载状态项

适配器工作正常,我还可以通过添加 LoadStateListener 来获取负载状态。只有负载状态适配器不工作。我已经跟踪并克隆了,它运行良好。我的可能是什么问题?

android android-paging android-paging-library android-paging-3

5
推荐指数
1
解决办法
1638
查看次数