ExpandableListViewDemo.zip
资源来源:本地上传资源
文件类型:ZIP
大小:438.9KB
评分:
5.0
上传者:west8623
更新日期:2013-02-19
ExpandableListViewDemo
资源文件列表(大概)
文件名
大小
ExpandableListViewDemo/
-
ExpandableListViewDemo/.classpath
364B
ExpandableListViewDemo/.project
858B
ExpandableListViewDemo/AndroidManifest.xml
798B
ExpandableListViewDemo/assets/
-
ExpandableListViewDemo/bin/
-
ExpandableListViewDemo/bin/ExpandableListViewDemo.apk
31.28KB
ExpandableListViewDemo/bin/classes/
-
ExpandableListViewDemo/bin/classes/com/
-
ExpandableListViewDemo/bin/classes/com/bo/
-
ExpandableListViewDemo/bin/classes/com/bo/Group.class
507B
ExpandableListViewDemo/bin/classes/com/bo/People.class
894B
ExpandableListViewDemo/bin/classes/com/example/
-
ExpandableListViewDemo/bin/classes/com/example/expandable/
-
ExpandableListViewDemo/bin/classes/com/example/expandable/MainActivity$ChildHolder.class
668B
ExpandableListViewDemo/bin/classes/com/example/expandable/MainActivity$GroupHolder.class
628B
ExpandableListViewDemo/bin/classes/com/example/expandable/MainActivity$MyexpandableListAdapter.class
4KB
ExpandableListViewDemo/bin/classes/com/example/expandable/MainActivity.class
4.23KB
ExpandableListViewDemo/bin/classes/com/example/expandable/R$attr.class
352B
ExpandableListViewDemo/bin/classes/com/example/expandable/R$color.class
858B
ExpandableListViewDemo/bin/classes/com/example/expandable/R$drawable.class
630B
ExpandableListViewDemo/bin/classes/com/example/expandable/R$id.class
585B
ExpandableListViewDemo/bin/classes/com/example/expandable/R$layout.class
464B
ExpandableListViewDemo/bin/classes/com/example/expandable/R$menu.class
400B
ExpandableListViewDemo/bin/classes/com/example/expandable/R$string.class
525B
ExpandableListViewDemo/bin/classes/com/example/expandable/R$style.class
407B
ExpandableListViewDemo/bin/classes/com/example/expandable/R.class
713B
ExpandableListViewDemo/bin/classes.dex
9.85KB
ExpandableListViewDemo/bin/res/
-
ExpandableListViewDemo/bin/res/drawable-hdpi/
-
ExpandableListViewDemo/bin/res/drawable-hdpi/collapse.png
311B
ExpandableListViewDemo/bin/res/drawable-hdpi/expanded.png
288B
ExpandableListViewDemo/bin/res/drawable-hdpi/ic_action_search.png
409B
ExpandableListViewDemo/bin/res/drawable-hdpi/ic_launcher.png
4.03KB
ExpandableListViewDemo/bin/res/drawable-ldpi/
-
ExpandableListViewDemo/bin/res/drawable-ldpi/ic_launcher.png
1.71KB
ExpandableListViewDemo/bin/res/drawable-mdpi/
-
ExpandableListViewDemo/bin/res/drawable-mdpi/ic_action_search.png
311B
ExpandableListViewDemo/bin/res/drawable-mdpi/ic_launcher.png
2.59KB
ExpandableListViewDemo/bin/res/drawable-xhdpi/
-
ExpandableListViewDemo/bin/res/drawable-xhdpi/ic_action_search.png
491B
ExpandableListViewDemo/bin/res/drawable-xhdpi/ic_launcher.png
5.33KB
ExpandableListViewDemo/bin/resources.ap_
24.23KB
ExpandableListViewDemo/gen/
-
ExpandableListViewDemo/gen/com/
-
ExpandableListViewDemo/gen/com/example/
-
ExpandableListViewDemo/gen/com/example/expandable/
-
ExpandableListViewDemo/gen/com/example/expandable/R.java
2.69KB
ExpandableListViewDemo/ic_launcher-web.png
36.23KB
ExpandableListViewDemo/libs/
-
ExpandableListViewDemo/libs/android-support-v4.jar
329.65KB
ExpandableListViewDemo/proguard-project.txt
781B
ExpandableListViewDemo/project.properties
562B
ExpandableListViewDemo/res/
-
ExpandableListViewDemo/res/drawable/
-
ExpandableListViewDemo/res/drawable/child_bg.xml
427B
ExpandableListViewDemo/res/drawable/selector_group.xml
340B
ExpandableListViewDemo/res/drawable/selector_item.xml
295B
ExpandableListViewDemo/res/drawable-hdpi/
-
ExpandableListViewDemo/res/drawable-hdpi/collapse.png
311B
ExpandableListViewDemo/res/drawable-hdpi/expanded.png
288B
ExpandableListViewDemo/res/drawable-hdpi/ic_action_search.png
3.05KB
ExpandableListViewDemo/res/drawable-hdpi/ic_launcher.png
2.94KB
ExpandableListViewDemo/res/drawable-ldpi/
-
ExpandableListViewDemo/res/drawable-ldpi/ic_launcher.png
1.47KB
ExpandableListViewDemo/res/drawable-mdpi/
-
ExpandableListViewDemo/res/drawable-mdpi/ic_action_search.png
2.96KB
ExpandableListViewDemo/res/drawable-mdpi/ic_launcher.png
1.92KB
ExpandableListViewDemo/res/drawable-xhdpi/
-
ExpandableListViewDemo/res/drawable-xhdpi/ic_action_search.png
3.12KB
ExpandableListViewDemo/res/drawable-xhdpi/ic_launcher.png
3.91KB
ExpandableListViewDemo/res/layout/
-
ExpandableListViewDemo/res/layout/child.xml
1.29KB
ExpandableListViewDemo/res/layout/group.xml
845B
ExpandableListViewDemo/res/layout/main.xml
1.05KB
ExpandableListViewDemo/res/menu/
-
ExpandableListViewDemo/res/menu/main.xml
203B
ExpandableListViewDemo/res/values/
-
ExpandableListViewDemo/res/values/color.xml
772B
ExpandableListViewDemo/res/values/strings.xml
254B
ExpandableListViewDemo/res/values/styles.xml
89B
ExpandableListViewDemo/src/
-
ExpandableListViewDemo/src/com/
-
ExpandableListViewDemo/src/com/bo/
-
ExpandableListViewDemo/src/com/bo/Group.java
190B
ExpandableListViewDemo/src/com/bo/People.java
460B
ExpandableListViewDemo/src/com/example/
-
ExpandableListViewDemo/src/com/example/expandable/
-
ExpandableListViewDemo/src/com/example/expandable/MainActivity.java
6.08KB
资源内容介绍
有时候,使用ListView并不能满足应用程序所需要的功能。有些应用程序需要多组ListView,这时候我们就要使用一种新的控件ExpandableListView——可以扩展的ListView。它的作用就是将ListView进行分组。就好像我们使用QQ的时候,有“我的好友”,“陌生人”,“黑名单”一样,点击一下会扩展开,再点击一下又会收缩回去。ExpandableListView是一个垂直滚动显示两级列表项的视图,与ListView不同的是,它可以有两层:每一层都能够被独立的展开并显示其子项。这些子项来自于与该视图关联的ExpandableListAdapter。每一个可以扩展的列表项的旁边都有一个指示符(箭头)用来说明该列表项目前的状态(这些状态一般是已经扩展开的列表项,还没有扩展开的列表项,子列表项和最后一个子列表项)。可以使用方法:setChildIndicator(Drawable),setGroupIndicator(Drawable)(或者相应的XML文件的属性) 去设置这些指示符的样式。当然也可以使用默认的指示符。布android.R.layout.simple_expandable_list_item_1,android.R.layout.simple_expandable_list_item_2和ListView一样,ExpandableListView也是一个需要Adapter作为桥梁来取得数据的控件。一般适用于ExpandableListView的Adapter都要继承BaseExpandableListAdapter这个类,并且必须重载getGroupView和getChildView这两个最为重要的方法。BaseExpandableListAdapter的主要重载方法如下:public abstract ObjectgetChild (int groupPosition, int childPosition)取得与指定分组、指定子项目关联的数据.参数groupPosition 包含子视图的分组的位置.childPosition 指定的分组中的子视图的位置.返回与子视图关联的数据.public abstract long getChildId (int groupPosition, intchildPosition)取得给定分组中给定子视图的ID. 该组ID必须在组中是唯一的.必须不同于其他所有ID(分组及子项目的ID).参数groupPosition 包含子视图的分组的位置.childPosition 要取得ID的指定的分组中的子视图的位置.返回与子视图关联的ID.public abstract View getChildView (int groupPosition, intchildPosition, boolean isLastChild, View convertView, ViewGroup parent)取得显示给定分组给定子位置的数据用的视图.参数groupPosition 包含要取得子视图的分组位置.childPosition 分组中子视图(要返回的视图)的位置.isLastChild 该视图是否为组中的最后一个视图.convertView 如果可能,重用旧的视图对象.使用前你应该保证视图对象为非空,并且是否是合适的类型.如果该对象不能转换为可以正确显示数据的视图,该方法就创建新视图.不保证使用先前由 getChildView(int, int,boolean, View, ViewGroup)创建的视图.parent 该视图最终从属的父视图.返回指定位置相应的子视图.public abstract int getChildrenCount (int groupPosition)取得指定分组的子元素数.参数groupPosition 要取得子元素个数的分组位置.返回指定分组的子元素个数.public abstract long getCombinedChildId (long groupId, long childId)取得一览中可以唯一识别子条目的 ID(包括分组ID和子条目ID).可扩展列表要求每个条目 (分组条目和子条目)具有一个可以唯一识别列表中子条目和分组条目的ID. 该方法根据给定子条目ID和分组条目ID返回唯一识别ID.另外,如果 hasStableIds() 为真,该函数返回的ID必须是固定不变的.参数groupId 包含子条目ID的分组条目ID.childId 子条目的ID.返回可以在所有分组条目和子条目中唯一识别该子条目的ID(可能是固定不变的).public abstract long getCombinedGroupId (long groupId)取得一览中可以唯一识别子条目的 ID(包括分组ID和子条目ID).可扩展列表要求每个条目 (分组条目和子条目)具有一个可以唯一识别列表中子条目和分组条目的ID. 该方法根据给定子条目ID和分组条目ID返回唯一识别ID.另外,如果 hasStableIds() 为真,该函数返回的ID必须是固定不变的.参数groupId 分组条目ID.返回可以在所有分组条目和子条目中唯一识别该分组条目的ID(可能是固定不变的).public abstract Object getGroup (int groupPosition)取得与给定分组关联的数据.参数groupPosition 分组的位置.返回指定分组的数据.public abstract int getGroupCount ()取得分组数.返回分组数.public abstract long getGroupId (int groupPosition)取得指定分组的ID.该组ID必须在组中是唯一的.必须不同于其他所有ID(分组及子项目的ID).参数groupPosition 要取得ID的分组位置.返回与分组关联的ID.public abstract View getGroupView (int groupPosition, booleanisExpanded, View convertView, ViewGroup parent)取得用于显示给定分组的视图. 这个方法仅返回分组的视图对象, 要想获取子元素的视图对象,就需要调用 getChildView(int, int, boolean, View, ViewGroup).参数groupPosition 决定返回哪个视图的组位置 .isExpanded 该组是展开状态还是收起状态 .convertView 如果可能,重用旧的视图对象.使用前你应该保证视图对象为非空,并且是否是合适的类型.如果该对象不能转换为可以正确显示数据的视图,该方法就创建新视图.不保证使用先前由 getGroupView(int, boolean,View, ViewGroup)创建的视图.parent 该视图最终从属的父视图.返回指定位置相应的组视图.public abstract boolean hasStableIds ()是否指定分组视图及其子视图的ID对应的后台数据改变也会保持该ID.返回是否相同的ID总是指向同一个对象.public abstract boolean isChildSelectable (int groupPosition, intchildPosition)指定位置的子视图是否可选择.参数groupPosition 包含要取得子视图的分组位置.childPosition 分组中子视图的位置.返回是否子视图可选择.注意:在XML布局文件中,如果ExpandableListView上一级视图的大小没有严格定义的话,则不能对ExpandableListView的android:layout_height 属性使用wrap_content值。 (例如,如果上一级视图是ScrollView的话,则不应该指定wrap_content的值,因为它可以是任意的长度。不过,如果ExpandableListView的上一级视图有特定的大小的话,比如100像素,则可以使用wrap_content)如果由于开发的时候粗心,对ExpandableListView指定wrap_content的值,则会报一个在SetContentView处的空指针错误。用户评论 (0)
发表评论
相关资源
高仿qq最新安卓版头像裁剪
文件名:ClipHeadPhoto.zip
文件类型:ZIP
大小:1.25MB
上传者:baiyuliang2013
更新日期:2015-03-02
webUploader Demo源码下载
文件名:uploadDemo.zip
文件类型:ZIP
大小:254.39KB
上传者:wx11408115
更新日期:2017-04-17
android流式布局
文件名:FlowLayoutDemo.zip
文件类型:ZIP
大小:1.17MB
上传者:chenshi011
更新日期:2014-01-26
Android 仿微信朋友圈9宫格图片展示&多选图片
文件名:FriendCircleDemo.zip
文件类型:ZIP
大小:5.38MB
上传者:airsaid
更新日期:2016-03-31
android 日历控件 实现日历月份切换,给某一天加标记
文件名:android-CalendarView-by-idle_wu.zip
文件类型:ZIP
大小:964.21KB
上传者:zcw1247599259
更新日期:2014-01-10
Bamboy高斯模糊(毛玻璃)
文件名:Bamboy高斯模糊(毛玻璃).zip
文件类型:ZIP
大小:8.52MB
上传者:bamboy_
更新日期:2017-01-11
ShareSDKv2.1.1 简化压缩 使用教程
文件名:SimpleShareSDK.zip
文件类型:ZIP
大小:8.1MB
上传者:li6185377
更新日期:2013-05-21
模仿qq群组滑动界面切换
文件名:QQDemo.zip
文件类型:ZIP
大小:579.39KB
上传者:jansin_love
更新日期:2013-05-23
framework-xposed-v89-sdk25-x86
文件名:framework-xposed-v89-sdk25-x86.zip
文件类型:ZIP
大小:7.28MB
上传者:tomatomas
更新日期:2022-08-04
system-images.zip
文件名:system-images.zip
文件类型:ZIP
大小:9.2MB
上传者:win_xiang
更新日期:2012-03-31