---
title: "说说定制自己的CursorAdapter"
author: "gty509"
date: "2009-12-16T00:50:22Z"
tags: []
categories: ["移动开发"]
slug: "cursoradapter"
draft: false
lastmod: "2009-12-16T00:50:22Z"
id: 549326
url: "https://gty509.iteye.com/blog/549326"
---

一般书里面也没有介绍如何使用CursorAdapter,要定制自己的CursorAdapter, 要覆盖newView, bindView和changeCursor. 现在以ListView为例来说明：

![](http://tangglobal.com/CursorAdapter.png)


从上面可以看出，listView不是每次都会调用newView，所以每个item的view对象只会被实例化一次。而每次要绘制item之前，一定会调用bindView。这是动态绑定。如果记录被修改了，在ListView会实时更新。如果要实现数据的延迟加载，可以在bindView中先加载，再启动后台线程加载。

对于那些不用到数据库的应用，也可以用MatrixCursor来生成cursor对象。