ExpandableListView 长按事件
来源:互联网 发布:java 数组异或运算 编辑:程序博客网 时间:2024/04/30 04:29
ExpandableListView 中没有onGroupLongClickListener,也没有onChildLongClickListener,这就为我们自定义ExpandableListView 的长按事件增加了困难。
下面是我用OnItemLongClickListener写的一个自定义child的长按事件:
/** * OnLongClickListener */OnItemLongClickListener onItemLongClickListener = new OnItemLongClickListener() {public boolean onItemLongClick(AdapterView<?> parent, View childView,int flatPos, long id) {if (ExpandableListView.getPackedPositionType(id) == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {long packedPos = ((ExpandableListView) parent).getExpandableListPosition(flatPos);final int groupPosition = ExpandableListView.getPackedPositionGroup(packedPos);final int childPosition = ExpandableListView.getPackedPositionChild(packedPos);if(adapter.getChild(groupPosition, childPosition).equals("Empty")){Toast.makeText(getApplicationContext(), "It's empty.", 1).show();}else{AlertDialog.Builder dialog = new AlertDialog.Builder(secPlayBackActivity.this);dialog.setTitle("Delete this file?");dialog.setPositiveButton("Yes", new OnClickListener() {@Overridepublic void onClick(DialogInterface arg0, int arg1) {// delete checked fileString path = baseSpecphoneDir+ adapter.getGroup(groupPosition)+ "/"+ adapter.getChild(groupPosition, childPosition);upDirectory = baseSpecphoneDir+ adapter.getGroup(groupPosition);fileDelete(path);groupPos = groupPosition;}});dialog.setNegativeButton("Cancel", null);dialog.setCancelable(false);dialog.create().show();}return true;}return false;}};
0 0
- ExpandableListView 长按事件
- ExpandableListView长按事件
- ExpandableListView 长按事件
- Android ExpandableListView长按事件
- Android ExpandableListView长按事件完美解决
- Android ExpandableListView长按事件解决方法一
- ExpandableListView长按事件解决方法二
- Android ExpandableListView长按事件完美解决
- 完美解决ExpandableListView长按点击事件
- ExpandableListView长按事件完美解决
- Android ExpandableListView长按事件完美解决
- Android ExpandableListView长按事件完美解决
- Android ExpandableListView 长按事件 position问题
- ExpandableListView长按事件解决方法 使用算法而不是view.setTag()
- ExpandableListView长按事件怎么获取groupPosition和childPosition
- ExpandableListView 长按实现
- Android中ExpandableListView中含有Checkbox,Group长按事件无效,ChildItem长按事件有效
- 长按ExpandableListView中的选项
- myeclipse配置hadoop开发环境
- 代码整理——testClient
- jquery-easyui datagrid 无数据提示
- 使用 JSLint 保证 JavaScript 代码质量
- 做到这六点,你就是公司的宝!
- ExpandableListView 长按事件
- 关于lua table是否为空的判断
- JUnit的各种断言
- 【Unity Shaders】Diffuse Shading——在Surface Shader中使用properties
- 【CSDN博客之星】2013年CSDN博客之星正在评选,希望大家支持投票,非常感谢!
- CString与double互相转化
- Linux下JNI的实现
- SSH Action 中Ajax的调用
- 代码整理——tempServer(运行自动关机)