ExpandableListView的用法与普通 ListView的用法非常相似,只是 ExpandableListView所显示的列表项应 该由 ExpandableListAdapter 提供。 ExpandableListAdapter 也是一个接口,该接口下提供的类继承关系图如下图所示。 ? 与Adapter类似的是,实现 ExpandableListAdapter也有如下三种常用方式。 使用 SimpleExpandableListAdapter 将两个 List 集合包装成 ExpandableListAdapter。 * * @return * @see android.widget.ExpandableListAdapter#hasStableIds() */ @Override
super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //创建一个ExpandableListAdapter 对象 final ExpandableListAdapter adapter = new ExpandableListAdapter() { int[] logos
我们知道使用 ExpandableListView 要为它配置个 数据是配置器,也就是ExpandableListAdapter,它有9个接口函数要求重写,具体请转至我的的专题介绍了解它:http:// ---------------------------------------------------------总结: ExpandableListView 的 数据适配器 ExpandableListAdapter
一、ExpandableListView介绍 一个垂直滚动的显示两个级别(Child,Group)列表项的视图,列表项来自ExpandableListAdapter 。组可以单独展开。 menuInfo.packedPosition); int childPos =ExpandableListView.getPackedPositionChild(menuInfo.packedPosition); 二、ExpandableListAdapter
适配器类型为ExpandableListAdapter expandGroup : 展开指定分组。 collapseGroup : 收起指定分组。 OnChildClickListener 设置监听器的方法 : setOnChildClickListener 监听器需要重写的点击方法 : onChildClick ExpandableListView适配器 ExpandableListAdapter 下面是ExpandableListAdapter经常要重写的几个方法: getGroupCount : 获取分组的个数。 getChildrenCount : 获取子项的个数。 要让子项目响应点击事件,需满足下面三个条件: 1、ExpandableListAdapter适配器的isChildSelectable方法要返回true; 2、ExpandableListView对象要注册监听器 android.widget.TextView; import android.widget.Toast; public class CustomExpandAdapter implements ExpandableListAdapter
以下是对ExpandableListView的一些基本特性和用法: 数据源:ExpandableListView需要一个适配器(ExpandableListAdapter)来提供数据源。
android.widget.AbsListView; 9 import android.widget.BaseExpandableListAdapter; 10 import android.widget.ExpandableListAdapter savedInstanceState); 72 setContentView(R.layout.el_main); 73 74 /**BaseExpandableListAdapter实现了ExpandableListAdapter */ 75 ExpandableListAdapter adapter = new BaseExpandableListAdapter(){ 76 77 78
childList.get(groupPosition).size(); } /* * 获得组项 (non-Javadoc) * * @see android.widget.ExpandableListAdapter
android.widget.AdapterView; import android.widget.BaseExpandableListAdapter; import android.widget.ExpandableListAdapter
AnimatorSet Android开发笔记(九十六)集合动画与属性动画 路径、矩阵 Path、Matrix Android开发笔记(九十九)圆形转盘 折叠列表视图 ExpandableListView、ExpandableListAdapter