expandablelistview

Android自定义ExpandableListView

我只是一个虾纸丫 提交于 2020-03-09 06:27:32
ExpandableListView是android中可以实现下拉list的一个控件,是一个垂直滚动的心事两个级别列表项 手风琴 试图,列表项是来自ExpandableListViewaAdapter,组可以单独展开。 重要方法: expandGroup (int groupPos) ;//在分组列表视图中 展开一组, setSelectedGroup (int groupPosition) ;//设置选择指定的组。 setSelectedChild (int groupPosition, int childPosition, boolean shouldExpandGroup);//设置选择指定的子项。 getPackedPositionGroup (long packedPosition);//返回所选择的组 getPackedPositionForChild (int groupPosition, int childPosition) ;//返回所选择的子项 getPackedPositionType (long packedPosition);//返回所选择项的类型(Child,Group) isGroupExpanded (int groupPosition);//判断此组是否展开 expandableListView.setDivider()

android ExpandableListView详解

随声附和 提交于 2020-03-09 06:25:37
ExpandableListView是android中可以实现下拉list的一个控件,是一个垂直滚动的心事两个级别列表项手风琴试图,列表项是来自ExpandableListViewaAdapter,组可以单独展开。 重要方法: 1 expandGroup (int groupPos) ;//在分组列表视图中 展开一组, 2 setSelectedGroup (int groupPosition) ;//设置选择指定的组。 3 4 setSelectedChild (int groupPosition, int childPosition, boolean shouldExpandGroup);//设置选择指定的子项。 5 6 getPackedPositionGroup (long packedPosition);//返回所选择的组 7 8 getPackedPositionForChild (int groupPosition, int childPosition) ;//返回所选择的子项 9 10 getPackedPositionType (long packedPosition);//返回所选择项的类型(Child,Group) 11 12 isGroupExpanded (int groupPosition);//判断此组是否展开 expandableListView

Android:ExpandableListView使用

|▌冷眼眸甩不掉的悲伤 提交于 2020-03-09 06:20:26
前言 眼下回到了工作岗位,第一件事情就是ExpandListView的优化。这里简单的用一个Demo介绍一下ExpandableListView的使用。 简介一下Demo实现的功能,主要是继承BaseExpandableListAdapter来自己定义adapter呈现ExpandableListView数据: 每一个child item有一个TextView和一个ImageView删除标识。 当点击一个child item,弹出Toast提示。 child item能够通过点击删除图标来删除。 每次展开特定group时。其它group自己主动收缩。 Demo效果展示: Android实现 创建一个新的Android项目,我将其命名为expandtutorial。 XML布局文件 expandtutorial项目总共须要三个xml布局文件。各自是activity_main.xml。 child_item.xml。 group_item.xml。 activity_main.xml 这个是用来布局ExpandableListView的,内容例如以下: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com

ExpandableListView实现手风琴效果

僤鯓⒐⒋嵵緔 提交于 2020-02-29 06:24:57
1. 效果示例图 2. 创建方法 (1)第一种方法与ListView等普通控件一样,直接在布局文件中添加ExpandableListView控件即可。 (2)第二种方法则是创建一个Activity继承自ExpandableListActivity,而后通过getExpandableListView()方法可获得一个ExpandableListView对象。 第二种方法仅适用于一个页面中只有一个ExpandableListView的情况。继承的Activity不需要再调用setContentView()方法,在ExpandableListActivity中已经关联了一个系统定义的布局文件。 3. 部分属性和点击事件 android:groupIndicator、android:childIndicator:组条目和子条目前面的图标,默认值为箭头,可设置自定义图片资源。若不显示该图标,则设置为@null。 android:divider、android:childDivider:组和子条目的分隔线。 ExpandableListView的点击事件有两个,分别对应组和子条目的点击事件: 设置组的点击事件:setOnGroupClickListener(OnGroupClickListener listener) 设置子条目的点击事件:setOnChildClickListener

Android 多级菜单实现

家住魔仙堡 提交于 2020-02-15 05:11:20
  在Android里要实现树形菜单,都是用ExpandableList,但是ExpandableList一般只能实现2级树形菜单......本文也依然使用ExpandableList,但是要实现的是3级树形菜单。程序运行效果图:                                  当用BaseExpandableListAdapter来实现二级树形菜单时,父项(getGroupView())和子项(getChildView())都是使用TextView。当要实现三级树形菜单时,子项(getChildView())就必须使用ExpandableList了.......另外还要定义结构体来方便调用三级树形的数据,二级树形菜单可以用如下: View Code static public class TreeNode{ Object parent; List<Object> childs=new ArrayList<Object>(); }   三级树形菜单可以用如下,子项是二级树形菜单的结构体: View Code static public class SuperTreeNode { Object parent; //二级树形菜单的结构体 List<TreeViewAdapter.TreeNode> childs = new ArrayList

ExpandableListView: wrong groupPosition returned if there's an expanded childView

北慕城南 提交于 2020-02-05 14:38:47
问题 I have an ExpandableListView; the single item (group item) of the list has a FrameLayout that contains a ToggleButton. I did this in order to increase the button's touch area. I use the button to expand the child view of the group item it belongs to. There can't be two checked buttons at a time, because when one gets checked, the previous one that was checked gets unchecked. Now, the first time I click on the button of an item, it toggles alright; when, after that, I click on the one of

ExpandableListView - border around parent and its children

杀马特。学长 韩版系。学妹 提交于 2020-02-03 08:11:27
问题 I have a view that uses the ExpandableListView that has a ton of logic around it and in the adapters. For e.g., it looks like this I have a requirement to display the same view with a different skin that has the expand/collapse hidden and has a border around parent and its children, something like this I see attributes to have border for the whole control or just parent or individual child but nothing to have a border around parent and its children. Has anyone done something like this? Short

Xamarin.Forms: How to expand row from listview over full screen after tap or click?

故事扮演 提交于 2020-02-02 11:07:45
问题 I have two cell templates that appears in ListView . After clicking or taping on a cell, loading the second expanded (resized) template which is longer and shows more information. Problem is that I would like second template to expand and extend over the entire screen (from the toolbar to the bottom), not only as much as the content of template. To be perfectly clear, I do not want to open up a new window (Navigation.PushAsync), but to expand whole content in full screen. For now I have a way

Xamarin.Forms: How to expand row from listview over full screen after tap or click?

别来无恙 提交于 2020-02-02 11:07:13
问题 I have two cell templates that appears in ListView . After clicking or taping on a cell, loading the second expanded (resized) template which is longer and shows more information. Problem is that I would like second template to expand and extend over the entire screen (from the toolbar to the bottom), not only as much as the content of template. To be perfectly clear, I do not want to open up a new window (Navigation.PushAsync), but to expand whole content in full screen. For now I have a way

Xamarin.Forms: How to expand row from listview over full screen after tap or click?

梦想与她 提交于 2020-02-02 11:06:48
问题 I have two cell templates that appears in ListView . After clicking or taping on a cell, loading the second expanded (resized) template which is longer and shows more information. Problem is that I would like second template to expand and extend over the entire screen (from the toolbar to the bottom), not only as much as the content of template. To be perfectly clear, I do not want to open up a new window (Navigation.PushAsync), but to expand whole content in full screen. For now I have a way