Android BaseAdapter类重写模版
来源:互联网 发布:java软件开发项目经验 编辑:程序博客网 时间:2024/05/16 12:08
BaseAdapter 需要实现的
① 继承类的构造方法
② public int getCount()
③ public Object getItem(int position)
④ public long getItemId(int position)
⑤ public View getView(int position , View converView , ViewGroup parent)
这个很重要,这个View 显示 某一指定位置的视图。
模版如下:
public class ImageAdapter extends BaseAdapter { private Context mContext; public ImageAdapter(Context c) { mContext = c; } public int getCount() { return mThumbIds.length; } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } // create a new ImageView for each item referenced by the Adapter public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some attributes ...... } else { imageView = (ImageView) convertView; } imageView.setImageResource(mThumbIds[position]); return imageView; } // references to our images private Integer[] mThumbIds = { R.drawable.sample_2, R.drawable.sample_3, };}
- Android BaseAdapter类重写模版
- android 重写BaseAdapter类
- 重写BaseAdapter后getView的模版
- Android 重写BaseAdapter中的getView
- Android关于重写BaseAdapter在setAdapter抛出ArrayIndexOutOfBoundsException的问题
- Android 重写BaseAdapter碰到getView中convertView出现错误
- Android基础类之BaseAdapter
- Android基础类之BaseAdapter
- Android基础类之BaseAdapter
- Android基础类之BaseAdapter
- Android基础类之BaseAdapter
- Android基础类之BaseAdapter
- Android基础类之BaseAdapter
- Android基础类之BaseAdapter
- Android基础类之BaseAdapter
- Android基础类之BaseAdapter
- Android基础类之BaseAdapter
- Android中BaseAdapter基础类
- 运维架构师-并不遥远的彼岸
- Java实现RSS
- IPv6简介
- 瑞星:以创新引领个人安全市场
- 在 Xcode 中进行自动化测试 (1/2)
- Android BaseAdapter类重写模版
- Oracle排序过滤重复数据
- 非oracle用户无法运行sqlplus
- 数字方舟,末日起航-记2012云计算架构师峰会
- [推荐] 常见设计模式的解析和实现(C++) 全20部分
- DateUtil类
- istringstream用法
- C/C++联合(Union)浅谈 .
- 在 Xcode 中进行自动化测试 (2/2)