Android7.0中文文档(API)-- SimpleAdapter

完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/SimpleAdapter.html

SimpleAdapter

public class SimpleAdapter
extends BaseAdapter implements Filterable, ThemedSpinnerAdapter

java.lang.Object
   ↳android.widget.BaseAdapter
    ↳android.widget.SimpleAdapter


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 a SimpleAdapter.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:

If no appropriate binding can be found, an IllegalStateException is thrown.
一个简单的适配器,映射数据到定义在一个XML文件中的视图。你可以将列表中的数据指定为Maps的ArrayList。ArrayList中的每个条目对应列表中的每一行。Maps中包含每行的数据。你还指定了一个XML文件,它的定义用于视图显示的行,以及从Map中Key映射特定的视图。将数据绑定到视图有两个阶段。首先,如果 SimpleAdapter.ViewBinder是可用的,则调用 setViewValue(android.view.View, Object, String)。如果返回值为true,则绑定成功。如果返回值为false,那么下面的视图将按顺序进行: 如果找不到合适的绑定,则抛出一个 IllegalStateException异常。

摘要


嵌套类

interfaceSimpleAdapter.ViewBinder

This class can be used by external clients of SimpleAdapter to bind values to views. 
这个类可以由SimpleAdapter的外部客户端使用,以便将值绑定到视图。 

继承常量

From interface android.widget.Adapter

Public构造方法

SimpleAdapter(Context context, List<? extends Map<String, ?>> data, int resource, String[] from, int[] to)

Constructor
构造方法

Public方法

intgetCount()

How many items are in the data set represented by this Adapter.
这个Adapter的数据集中有多少项。

ViewgetDropDownView(int position, View convertView, ViewGroup parent)

Gets a View that displays in the drop down popup the data at the specified position in the data set.
获取一个View,它将显示数据集中指定位置的数据。

Resources.ThemegetDropDownViewTheme()

Returns the value previously set by a call to setDropDownViewTheme(Theme).
返回setDropDownViewTheme(Theme)上次调用设置的值。

FiltergetFilter()

Returns a filter that can be used to constrain data with a filtering pattern.
返回一个过滤器,该过滤器可以使用过滤模式来约束数据。

ObjectgetItem(int position)

Get the data item associated with the specified position in the data set.
获取数据集中指定位置相关联的数据项。

longgetItemId(int position)

Get the row id associated with the specified position in the list.
获取列表中指定位置相关联的行ID。

ViewgetView(int position, View convertView, ViewGroup parent)

Get a View that displays the data at the specified position in the data set.
获取一个视图,它将显示数据集中指定位置的数据。

SimpleAdapter.ViewBindergetViewBinder()

Returns the SimpleAdapter.ViewBinder used to bind data to views.
返回SimpleAdapter.ViewBinder,其用于将数据绑定到视图。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值