4

怎么使用ViewModel 和 RecyclerView

 3 years ago
source link: https://jiajunhuang.com/articles/2021_01_03-recycler_list_view_model.md.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
怎么使用ViewModel 和 RecyclerView

怎么使用ViewModel 和 RecyclerView

当他们分开使用的时候,很简单,但是怎么把ViewModel和RecyclerView结合在一起呢?

代码如下:

model.assetItemList.observe(this, {
    binding.nothingHint.nothingHint.isVisible = it.isEmpty()

    val adapter = AssetDebtItemAdapter(it, currency)
    binding.recyclerView.adapter = adapter
    adapter.notifyDataSetChanged()
})

微信公众号
关注公众号,获得及时更新

ansible 简明教程

自己写个搜索引擎

HTTP 路由的两种常见设计形式

Golang的short variable declaration

Greenlet和Stackless Python

写一个简单的ORM

从源码看Python的descriptor

Python字符串格式化

Gunicorn 简明教程

Raft 论文阅读笔记

什么是 Golang Comparable Types

GFS 论文阅读

MapReduce 论文阅读

一起来做贼:Goroutine原理和Work stealing

Go语言的defer, panic和recover


@jiajunhuang 2015-2020, All Rights Reserved。本站禁止转载,引用请注明作者与原链。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK