【问题标题】:Android Paging 3 - get list of data from PagingData<T> object in Jetpack ComposeAndroid Paging 3 - 从 Jetpack Compose 中的 PagingData<T> 对象获取数据列表
【发布时间】:2022-01-07 02:13:41
【问题描述】:

我有与in this StackOverflow question 相同的问题,但对于 Jetpack Compose。

当您将 Paging3 与 LazyVerticalGrid 一起使用时,我们如何在 Jetpack Compose 中获取项目列表,因为使用 LazyVerticalGrid,我们不会创建任何 PagingDataAdapter.

【问题讨论】:

    标签: android-jetpack-compose android-paging android-paging-3


    【解决方案1】:

    LazyPagingItems 具有来自 PagingDataAdapter 的等效演示者 API。

    要获取整个列表,您可以使用LazyPagingItems.itemSnapshotList()

    要访问特定索引处的项目而不触发页面提取,您可以使用LazyPagingItems.peek

    【讨论】:

      猜你喜欢
      • 2021-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-12
      • 1970-01-01
      • 1970-01-01
      • 2021-11-25
      • 2022-01-05
      相关资源
      最近更新 更多