SimpleAdapter
java.lang.Object | ||
↳ | android.widget.BaseAdapter | |
| ↳ | android.widget.SimpleAdapter |
Class Overview
An easy adapter to map static data to views defined in an XML file. You can specify the data backing the list as an ArrayList of Maps. Each entry in the ArrayList corresponds to one row in the list. The Maps contain the data for each row. You also specify an XML file that defines the views used to display the row, and a mapping from keys in the Map to specific views. Binding data to views occurs in two phases. First, if aSimpleAdapter.ViewBinder
is available,setViewValue(android.view.View, Object, String)
is invoked. If the returned value is true, binding has occurred. If the returned value is false, the following views are then tried in order:
- A view that implements Checkable (e.g. CheckBox). The expected bind value is a boolean.
- TextView. The expected bind value is a string and
setViewText(TextView, String)
is invoked. (同时调用SetViewText(TextView, String)方法) - ImageView. The expected bind value is a resource id or a string and
setViewImage(ImageView, int)
orsetViewImage(ImageView, String)
is invoked.
If no appropriate binding can be found, an IllegalStateException
is thrown.
更多相关文章
- Android(安卓)AbsListView
- Binder框架的一些简单总结(关于自定义服务中的Binder)
- 第九章:Android中的数据存取
- 关于android各种双卡手机获取imei,imsi的处置(mtk,展讯,高通等)
- android动态增加控件时控制样式的方法
- Android中UI线程与后台线程交互设计的5种方法
- Android(安卓)滑动绘制流程探究 系统是如何提高滑动性能?
- Android(安卓)大图压缩处理,避免OOM
- 像写Flutter一样开发Android原生应用