BaseAdapter
来源:互联网 发布:winscp mac版下载 编辑:程序博客网 时间:2024/06/03 19:08
1,在main_Activity.xml中添加一个TextView
2,在item.xml中设置一个例子布局(图片,标题,内容)
3,创建一个BEAN类,用来封装用来要三个内容的数组(图片。两个TITL)定义+构造函数
4,在mainactivity中创建一个LIST集合<泛型>,然后构造假数据-= =
5,创建一个MyAdapter继承BaseAdapter,构建构造方法(集合),通过构造方法将数据源和数据适配器进行关联,重写实现四个方法
BaseAdapter基本结构:
1,public int getCount():适配器中数据集中数据的的个数
2,public OBject getItem(int positon)获取数据集中与指定索引对应的数据项
3,public long getItemId(int postion):获取指定行对应的ID
4,public view getView(int postion,View converView,Viewgroup parent);获取每一个Item的显示内容
lv = (ListView) findViewById(R.id.lv);//得到ListView对象的引用
SimpleAdapter
用来绑定在xml中定义的控件对应的数据
不同点是LayoutInflater是用来找res/layout/下的xml布局文件,并且实例化;而findViewById()是找xml布局文件下的具体widget控件(如Button、TextView等)。
阅读全文
0 0
- BaseAdapter
- baseAdapter
- BaseAdapter
- BaseAdapter
- BaseAdapter
- BaseAdapter
- baseAdapter
- BaseAdapter
- BaseAdapter
- BASEAdapter
- BaseAdapter
- BaseAdapter......
- BaseAdapter
- BaseAdapter
- BaseAdapter
- BaseAdapter
- BaseAdapter
- BaseAdapter
- jdbc连接数据库总结
- Bootstrap学习笔记2——BoostrapTable下载与简单运用
- 常用Linux指令之Chmod指令
- QT窗口操作函数(窗口最大化,全屏,隐藏最大化最小化按钮)
- 455. Assign Cookies
- BaseAdapter
- 二叉树的基本实现(一)
- 多重循环 方法和递归练习题+参考答案
- js实现简单的计算器
- 汉诺塔
- Java数据采集-3.抓取开源中国新闻(新版)
- SAR
- Day 1
- asp.net ibaitsNet初始化SqlMap.config