前阶段由于项目需要,参考百度上的资源,进行了一点整理
Android适配器是数据和视图之间的桥梁,以便于数据在View上显示;适配器类似显示器,将复杂的东西按人可以接受的方式来展现。
适配器模式有两种:
类适配器
对象适配器
我们常用的适配器一共有三个:ArrayAdapter,SimpleAdapter,SimpleCursorAdapter 这三个,他们都是继承于BaseAdapter
使用BaseAdapter比较简单,主要是通过继承此类来实现BaseAdapter的四个方法:
public int getCount(): 适配器中数据集的数据个数;
public Object getItem(int position): 获取数据集中与索引对应的数据项;
public long getItemId(int position): 获取指定行对应的ID;
public View getView(int position,View convertView,ViewGroup parent): 获取没一行Item的显示内容。
作者:王燕霞
原文链接:https://blog.csdn.net/be_me/article/details/80822389