andorid BaseAdapte
来源:互联网 发布:中航控制卡软件 编辑:程序博客网 时间:2024/05/18 00:26
public BaseAdapter baiduNewsAdapter=new BaseAdapter(){ //适配器 /** * 返回集合个数-------------------------------------显示的行数 */ public int getCount(){ return newList.size();//返回1显示1行,返回2,显示两行---返回显示的行数 } /** * 返回指定下标的id:决定了指定下标视图的id-----------------点击了哪一个 */public long getItemId(int position){ return positiom; }/** * 返回条目的视图数据(一个条目的所有内容) */ public Object getItem(int position){ return newList.get(position); //当返回0,第一条数据;返回1,第二条数据,返回2,第三条数据 // -----点击第一条,相当返回下标为0,系统显 //示第一条数据 } /** * 返回显示了指定下标实体数据的视图 * --int position下标, * --View convertView可回收的ItemView, * --ViewGroup parent很少用到 */ public View getView(int position,View convertView,ViewGroup parent){ //获取实体数据 String title=newList.get(postition); //给一个下标返回实体数据(集合中的数据) //初始化控件 布局膨胀 把xml文件转成View对象 //View.inflate(Context上下文,resource布局文件名(条目),root); View view=View.inflate(getBaseContext(),R.layout.list_item_news,null); //自定义标题(集合中的数据)[要自己设置] TextView titleView=(TextView) view.findViewById(R.id.title); titleView.setText(title); //其他的默认显示布局中的 return view; } }
0 0
- andorid BaseAdapte
- Android中SimpleAdapter,BaseAdapte详解
- Android中SimpleAdapter,BaseAdapte详解
- Andorid ireader
- andorid gridview
- Andorid Activity
- 学习andorid
- andorid webview
- Andorid控件
- Andorid更新
- andorid sp
- Andorid框架
- andorid 反编译
- andorid adk
- andorid,单元测试
- andorid编译
- andorid面试
- Andorid--Gson
- Netlink的简介及使用方法
- 好用的Python库
- ORACLE基本类型
- 帧中继动态映射与静态映射主要区别
- VC++简单数据库编程(三)——修改一条指定记录
- andorid BaseAdapte
- IOS 录制保存视频实例
- struts2中的<field-validator type="">,type有哪些?
- Singleton(二)
- linux内核内存管理学习之二(物理内存管理--伙伴系统)
- hdu 1556
- Ext.data.Store动态修改url
- VC++ Service编程(一)编写main函数
- 继承 初始化方法 便利构造器