ExpandableListView(手风琴)(1)---BaseExpandableListAdapter
来源:互联网 发布:oracle数据库的端口号 编辑:程序博客网 时间:2024/05/16 11:15
- 基础属性
groupIndicator 组左侧的箭头 - 事件
适配器处理
- 自定义抽象适配器继承BaseExpandableListAdapter 重写构造方法
//此处为public便于子类使用 获取控件public LayoutInflater mInflater; Context mContext; List<String> group; List<List<T>> child;public SJXBaseAdapter(Context context){ mContext=context; mInflater=LayoutInflater.from(context);}
添加数据方法
public void addData(List<String> group,List<List<T>> child){ this.group=group; this.child=child;}
两个抽象方法在getView中调用
public abstract View getGrougView(int groupPosition,View convertView);public abstract View getChildView(int groupPosition,int childPosition,View convertView);@Override public View getGroupView(int arg0, boolean arg1, View arg2, ViewGroup arg3) { return getGrougView(arg0, arg2);}@Overridepublic View getChildView(int arg0, int arg1, boolean arg2, View arg3,ViewGroup arg4) { return getChildView(arg0, arg1, arg3);}
- 自定义适配器继承上面的适配器
继承上述适配器 重写 构造方法 抽象方法
public LocalAdapter(Context context) { super(context); }@Override public View getChildView(int groupPosition, int childPosition, View convertView) { View childView=mInflater.from(context).inflate(布局文件id, null); TextView txtChild=(TextView) childView.findViewById(R.id.txt_child); txtChild.setText(child.get(groupPosition).get(childPosition)); txtChild.setPadding(0, 0, 0, 0); return childView; }
- 适配器关联activity
LocalAdapter ap=new LocalAdapter(this);ap.addData(list<>,list<list<String>>);activity.setAdapter(ap);
- 补充
适配器中getchild方法可以返回cursor
阅读全文
0 0
- ExpandableListView(手风琴)(1)---BaseExpandableListAdapter
- android ExpandableListView BaseExpandableListAdapter
- ExpandableListView、BaseExpandableListAdapter用法
- Android版手风琴(ExpandableListView)
- ExpandableListView 手风琴 效果
- ExpandableListView实现手风琴效果
- ExpandableListView实现手风琴效果
- ExpandableListView(手风琴)(2)---CursorTreeAdapter(数据库)
- ExpandableListView扩展(BaseExpandableListAdapter的使用)
- ExpandableListView以及BaseExpandableListAdapter的基本使用
- 可展开列表ExpandableListView—BaseExpandableListAdapter
- Android ExpandableListView 进行二级扩展 (BaseExpandableListAdapter)
- BaseExpandableListAdapter
- BaseExpandableListAdapter
- BaseExpandableListAdapter
- android之expandableListView+BaseExpandableListAdapter+ArrayList伸缩的用法:
- Android开发之ExpandableListView扩展(BaseExpandableListAdapter的使用)(完整版)
- Android开发之ExpandableListView扩展(BaseExpandableListAdapter的使用)(完整版)
- Android反编译dex2jar+JD-GUI(附反编译工具zip)
- HTTP详解--Http请求(四)
- centos7 安装 python3 mysqlclient 小记
- 数组、链表、栈、队列的实现。
- Linux下常用的C/C++开源Socket库
- ExpandableListView(手风琴)(1)---BaseExpandableListAdapter
- 【HDU 1109 Run Away 模拟退火算法】
- 贪心算法实例(二):钱币找零问题
- java 代码初始化数据库表结构,存储过程和函数的方法
- Qt中可以对图片镜像旋转
- 欢迎使用CSDN-markdown编辑器
- 膨胀的牛牛
- ios 用于调试的语句,在代码中添加容易定位位置
- Sybase修改interfaces文件(ip、端口、服务名等)