onGroupExpandListener; } public OnChildItemClickListener getOnChildClickListener() { return onChildClickListener...; } public void setOnChildClickListener( OnChildItemClickListener onChildClickListener...) { this.onChildClickListener = onChildClickListener; } private int mExpandedGroupPosition...} catch (JSONException e) { e.printStackTrace(); } } final private ExpandableListView.OnChildClickListener...mOnChildClickListener = new ExpandableListView.OnChildClickListener() { @Override public
一 ExpandableListView基本介绍 ExpandableListView是Android中的一个可扩展列表视图,它继承自ListView,并提供了支持展开和折叠的功能。...二 ExpandableListView使用方法 在 XML 布局文件中添加 ExpandableListView: ExpandableListView android:id="@+id/...ExpandableListView expandableListView = findViewById(R.id.expandableListView); // 创建适配器 MyExpandableListAdapter...(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView...onChildClickListener:用于设置子项的点击事件监听器,可以在用户点击子项时执行相应的操作。
新来的产品提了一个需求,让应用中的一个列表按照分类显示,并且能提示当前是在哪个分类,度娘了一番,参考了前辈们的博客,实现了如下图的效果: 效果图.gif 这种效果的实现这里是采用自定义ExpandableListView...一 项目结构 项目结构.PNG 上边儿三个类分别是我们的自定义ExpandableListView,主界面,以及ExpandableListView使用的Adapter。...下边儿几个xml文件分别是主界面布局,指示器布局,ExpandableListView子项布局,ExpandableListView组布局。...parent.size(); i++) { listview.expandGroup(i); } item点击事件 listview.setOnChildClickListener(new ExpandableListView.OnChildClickListener...() { @Override public boolean onChildClick(ExpandableListView expandableListView, View view,
ChildLists.add(childLists3); 2.把准备好的一级二级数据传入adapter ... mExpandableListView = dialogView.findViewById(R.id.expandablelistview...mExpandableListView.setAdapter(moAdapter); ... 3.监听点击事件 //一级选项点击回调 mExpandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener...() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition...//更新选中状态 return false; } }); //二级选项点击回调 mExpandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener...() { @Override public boolean onChildClick(ExpandableListView parent, View v, int reverseTypePosition
废话不说先上效果: 实际上这是采用一个ExpandableListView实现的 布局文件很简单: ExpandableListView组件--> ExpandableListView android:id="@+id/list" android:...layout_width="match_parent" android:layout_height="match_parent"> ExpandableListView> expandableListView = (ExpandableListView) findViewById(R.id.list); expandableListView.setOnChildClickListener...(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick
现在要做的就是设置监听 监听ImageView expandableListView 的点击事件,这里我是点图片展开和关闭Child,长点击expandableListView 也展开和关闭Child,...(id) == ExpandableListView.PACKED_POSITION_TYPE_GROUP) { long position = ((ExpandableListView) parent...(id) == ExpandableListView.PACKED_POSITION_TYPE_CHILD) { long position = ((ExpandableListView) parent...(id) == ExpandableListView.PACKED_POSITION_TYPE_GROUP) { long position = ((ExpandableListView) parent...(id) == ExpandableListView.PACKED_POSITION_TYPE_CHILD) { long position = ((ExpandableListView) parent
ExpandableListView常用方法 Android自带的ExpandableListView可以直接用于嵌套列表,点击一个组,展开该组下的子列表;再点击这个组,收起该组下的子列表。...OnGroupClickListener 设置监听器的方法 : setOnGroupClickListener 监听器需要重写的点击方法 : onGroupClick 4、子项点击事件,相关类名与方法说明如下: 监听器类名 : OnChildClickListener...ExpandableListView常见问题 ExpandableListView有时会发现子项不会响应点击事件,这可能是某个环节没有正确设置。...; import android.widget.ExpandableListView.OnChildClickListener; import android.widget.ExpandableListView.OnGroupClickListener...android.widget.Toast; public class CustomExpandAdapter implements ExpandableListAdapter,OnGroupClickListener,OnChildClickListener
android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import android.widget.ExpandableListView.OnChildClickListener...private void initEvents() { //child子项的单击事件 expandList.setOnChildClickListener(new OnChildClickListener...() { @Override public boolean onChildClick(ExpandableListView parent, View v...info = (ExpandableListView.ExpandableListContextMenuInfo)menuInfo; int type = ExpandableListView.getPackedPositionType...(info.packedPosition); if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
ExpandableListView组件是android中一个比较常用的组件,当点击一个父item的时候可以将它的子item显示出来,像手机QQ中的好友列表就是实现的类似效果。...使用ExpandableListView组件的关键就是设置它的adapter,这个adapter必须继承BaseExpandbaleListAdapter类,所以实现运用ExpandableListView...; import android.widget.TextView; public class MainActivity extends Activity { private ExpandableListView...)findViewById(R.id.expandableListView1); listView.setAdapter(new MyExpandableAdapter());..." > ExpandableListView android:id="@+id/expandableListView1" android:layout_width
首先我们用到的控件是:ExpandableListView 布局文件: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res...drawable/child_bg" 这个直接引color,或者图片会导致整个孩子背景都为这个颜色 ,不知道原因,如果有谁知道,请Give me say. --> ExpandableListView...android:groupIndicator="@null" android:scrollbarAlwaysDrawHorizontalTrack="true" > ExpandableListView...源码下载 /********************************LIstView模拟ExpandableListView**********************************...这个眨一看是ExpandableListView这个东东,可是本人比较笨戳,整了好久没有弄出来,最终放弃,google下,发现有人用listview来模拟实现,也就跟着做了下.
本期开始学习ExpandableListView的使用。...一、认识ExpandableListView ExpandableListView 是 ListView 的子类,它在普通ListView的基础上进行了扩展,它把应用中的列表项分为几组,每组里又可包含多个列表项...ExpandableListView的用法与普通 ListView的用法非常相似,只是 ExpandableListView所显示的列表项应 该由 ExpandableListAdapter 提供。...二、ExpandableListView 示例 接下来通过一个简单的示例程序来学习ExpandableListView的使用方法。...} }); // 监听每个分组里子控件的点击事件 mExpandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener
ExpandableListView,是ListView的子类。本质上是一个AdapterView,既然是AdapterView,在显示数据的时候,就需要使用到适配器。...-- 主界面就是可扩展列表;android:groupIndicator="@null" 取值可以是任意的Drawable对象,不再显示groupIndicator --> ExpandableListView...() { @Override public boolean onGroupClick(ExpandableListView expandableListView...false; } }); //监听事件2 expand_list_id.setOnChildClickListener(new ExpandableListView.OnChildClickListener...() { @Override public boolean onChildClick(ExpandableListView expandableListView
Android帮助文档 android.bluetooth www.pinnace.cn/bluetooth/tech/1940.shtml 此示例代码中有错: 在DeviceControlActivity类内:ExpandableListView.OnChildClickListener...每个Service下面的Characteristic 7,单击上图中的Characteristic UUID--->执行DeviceControlActivity:ExpandableListView.OnChildClickListener
Android也给我们提供ExpandableListView类,完美实现这样类似的需求, 极大的方便了我们开发。结合之前的项目我们做一个简单的讲解。 首先懒看一下最终的实现效果: ?...使用到的第三方框架: AndroidAutoLayout 屏幕适配框架 代码 首先是布局需要用一个ExpandableListView,配合adapter就能实现上面额效果,直接上代码。...public class MainActivity extends AppCompatActivity { private ExpandableListView elv_collocation;...super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); elv_collocation = (ExpandableListView...private List data; public CollocationListAdapter(Context context, ExpandableListView
match_parent" android:background="@color/target_divider_color" android:orientation="vertical"> ExpandableListView...} } }); //二级 mSecondListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener...() { @Override public boolean onGroupClick(ExpandableListView expandableListView...return true; } }); mSecondListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener...() { @Override public boolean onChildClick(ExpandableListView expandableListView
Android也给我们提供ExpandableListView类,完美实现这样类似的需求, 极大的方便了我们开发。结合之前的项目我们做一个简单的讲解。...使用到的第三方框架: AndroidAutoLayout 屏幕适配框架 代码 首先是布局需要用一个ExpandableListView,配合adapter就能实现上面额效果,直接上代码。...public class MainActivity extends AppCompatActivity { private ExpandableListView elv_collocation;...super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); elv_collocation = (ExpandableListView...private List data; public CollocationListAdapter(Context context, ExpandableListView
ExpandableListView是android中可以实现下拉list的一个控件,具体的实现方法如下: 首先:在layout的xml文件中定义一个ExpandableListView expandableListView" android:layout_width="fill_parent" android:layout_height=...添加上Adapter ExpandableListView expandableListView = (ExpandableListView)findViewById(R.id.expandableListView...=ExpandableListView.getPackedPositionGroup(menuInfo.packedPosition); int childPos =ExpandableListView.getPackedPositionChild...(menuInfo.packedPosition); 二、ExpandableListAdapter 一个接口,将基础数据链接到一个ExpandableListView。
(原创)转载请声明出处https://cloud.tencent.com/developer/user/1148436/activities 问题原型: ExpandableListView...--------------------直接看结论请拉置 红线下------------------- 早在同年5月份的时候我写过一篇 自定义 ExpandableListView 收缩类的...直到今天,本来想做个日程表,考虑到月份是可选的,所以想重新使用 ExpandableListView,逐使用之。...我们知道使用 ExpandableListView 要为它配置个 数据是配置器,也就是ExpandableListAdapter,它有9个接口函数要求重写,具体请转至我的的专题介绍了解它:http://...button 的存在导致 ExpandableListView 一级目录可点击性失效。这真是天坑,马上百度百度,看看有没有相同案例,百度了才发现,有碰到和我相同问题的,但是都没有解决!!!
这几天公司写个电商项目,写道购物车页面,发现ExpandableListView点击子类的方法无效!!
ExpandableListView 一、实现效果 二、实现步骤 1.编写父布局parent.xml 2.编写子布局child.xml 3.编写适配器类GradeAdapter 三、解析适配器类 一...、实现效果 ExpandableListView又称可扩展的ListView,简单来说长这个样: 每一个一级布局下面又可以展开二级布局。...二、实现步骤 使用ExpandableListView主要有三个步骤: 编写父布局 编写子布局 适配器的书写 1.编写父布局parent.xml 父布局其实很简单,就是两个并排的TextView,用于展示课程名字和分数...id="@+id/tv_teacher" style="@style/item_child_grade" /> 3.编写适配器类GradeAdapter 一般适用于ExpandableListView...布局代码也很简单,只要有一个ExpandableListView就好了: ExpandableListView android:id="@+id/expand_lv" android:layout_margin