首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

ExpandableListViewDemo

移动开发 438.9KB 40 需要积分: 1
立即下载

资源介绍:

有时候,使用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处的空指针错误。
# To enable ProGuard in your project, edit project.properties # to define the proguard.config property as described in that file. # # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in ${sdk.dir}/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the ProGuard # include property in project.properties. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #}

资源文件列表:

ExpandableListViewDemo.zip 大约有89个文件
  1. ExpandableListViewDemo/
  2. ExpandableListViewDemo/.classpath 364B
  3. ExpandableListViewDemo/.project 858B
  4. ExpandableListViewDemo/AndroidManifest.xml 798B
  5. ExpandableListViewDemo/assets/
  6. ExpandableListViewDemo/bin/
  7. ExpandableListViewDemo/bin/ExpandableListViewDemo.apk 31.28KB
  8. ExpandableListViewDemo/bin/classes/
  9. ExpandableListViewDemo/bin/classes/com/
  10. ExpandableListViewDemo/bin/classes/com/bo/
  11. ExpandableListViewDemo/bin/classes/com/bo/Group.class 507B
  12. ExpandableListViewDemo/bin/classes/com/bo/People.class 894B
  13. ExpandableListViewDemo/bin/classes/com/example/
  14. ExpandableListViewDemo/bin/classes/com/example/expandable/
  15. ExpandableListViewDemo/bin/classes/com/example/expandable/MainActivity$ChildHolder.class 668B
  16. ExpandableListViewDemo/bin/classes/com/example/expandable/MainActivity$GroupHolder.class 628B
  17. ExpandableListViewDemo/bin/classes/com/example/expandable/MainActivity$MyexpandableListAdapter.class 4KB
  18. ExpandableListViewDemo/bin/classes/com/example/expandable/MainActivity.class 4.23KB
  19. ExpandableListViewDemo/bin/classes/com/example/expandable/R$attr.class 352B
  20. ExpandableListViewDemo/bin/classes/com/example/expandable/R$color.class 858B
  21. ExpandableListViewDemo/bin/classes/com/example/expandable/R$drawable.class 630B
  22. ExpandableListViewDemo/bin/classes/com/example/expandable/R$id.class 585B
  23. ExpandableListViewDemo/bin/classes/com/example/expandable/R$layout.class 464B
  24. ExpandableListViewDemo/bin/classes/com/example/expandable/R$menu.class 400B
  25. ExpandableListViewDemo/bin/classes/com/example/expandable/R$string.class 525B
  26. ExpandableListViewDemo/bin/classes/com/example/expandable/R$style.class 407B
  27. ExpandableListViewDemo/bin/classes/com/example/expandable/R.class 713B
  28. ExpandableListViewDemo/bin/classes.dex 9.85KB
  29. ExpandableListViewDemo/bin/res/
  30. ExpandableListViewDemo/bin/res/drawable-hdpi/
  31. ExpandableListViewDemo/bin/res/drawable-hdpi/collapse.png 311B
  32. ExpandableListViewDemo/bin/res/drawable-hdpi/expanded.png 288B
  33. ExpandableListViewDemo/bin/res/drawable-hdpi/ic_action_search.png 409B
  34. ExpandableListViewDemo/bin/res/drawable-hdpi/ic_launcher.png 4.03KB
  35. ExpandableListViewDemo/bin/res/drawable-ldpi/
  36. ExpandableListViewDemo/bin/res/drawable-ldpi/ic_launcher.png 1.71KB
  37. ExpandableListViewDemo/bin/res/drawable-mdpi/
  38. ExpandableListViewDemo/bin/res/drawable-mdpi/ic_action_search.png 311B
  39. ExpandableListViewDemo/bin/res/drawable-mdpi/ic_launcher.png 2.59KB
  40. ExpandableListViewDemo/bin/res/drawable-xhdpi/
  41. ExpandableListViewDemo/bin/res/drawable-xhdpi/ic_action_search.png 491B
  42. ExpandableListViewDemo/bin/res/drawable-xhdpi/ic_launcher.png 5.33KB
  43. ExpandableListViewDemo/bin/resources.ap_ 24.23KB
  44. ExpandableListViewDemo/gen/
  45. ExpandableListViewDemo/gen/com/
  46. ExpandableListViewDemo/gen/com/example/
  47. ExpandableListViewDemo/gen/com/example/expandable/
  48. ExpandableListViewDemo/gen/com/example/expandable/R.java 2.69KB
  49. ExpandableListViewDemo/ic_launcher-web.png 36.23KB
  50. ExpandableListViewDemo/libs/
  51. ExpandableListViewDemo/libs/android-support-v4.jar 329.65KB
  52. ExpandableListViewDemo/proguard-project.txt 781B
  53. ExpandableListViewDemo/project.properties 562B
  54. ExpandableListViewDemo/res/
  55. ExpandableListViewDemo/res/drawable/
  56. ExpandableListViewDemo/res/drawable/child_bg.xml 427B
  57. ExpandableListViewDemo/res/drawable/selector_group.xml 340B
  58. ExpandableListViewDemo/res/drawable/selector_item.xml 295B
  59. ExpandableListViewDemo/res/drawable-hdpi/
  60. ExpandableListViewDemo/res/drawable-hdpi/collapse.png 311B
  61. ExpandableListViewDemo/res/drawable-hdpi/expanded.png 288B
  62. ExpandableListViewDemo/res/drawable-hdpi/ic_action_search.png 3.05KB
  63. ExpandableListViewDemo/res/drawable-hdpi/ic_launcher.png 2.94KB
  64. ExpandableListViewDemo/res/drawable-ldpi/
  65. ExpandableListViewDemo/res/drawable-ldpi/ic_launcher.png 1.47KB
  66. ExpandableListViewDemo/res/drawable-mdpi/
  67. ExpandableListViewDemo/res/drawable-mdpi/ic_action_search.png 2.96KB
  68. ExpandableListViewDemo/res/drawable-mdpi/ic_launcher.png 1.92KB
  69. ExpandableListViewDemo/res/drawable-xhdpi/
  70. ExpandableListViewDemo/res/drawable-xhdpi/ic_action_search.png 3.12KB
  71. ExpandableListViewDemo/res/drawable-xhdpi/ic_launcher.png 3.91KB
  72. ExpandableListViewDemo/res/layout/
  73. ExpandableListViewDemo/res/layout/child.xml 1.29KB
  74. ExpandableListViewDemo/res/layout/group.xml 845B
  75. ExpandableListViewDemo/res/layout/main.xml 1.05KB
  76. ExpandableListViewDemo/res/menu/
  77. ExpandableListViewDemo/res/menu/main.xml 203B
  78. ExpandableListViewDemo/res/values/
  79. ExpandableListViewDemo/res/values/color.xml 772B
  80. ExpandableListViewDemo/res/values/strings.xml 254B
  81. ExpandableListViewDemo/res/values/styles.xml 89B
  82. ExpandableListViewDemo/src/
  83. ExpandableListViewDemo/src/com/
  84. ExpandableListViewDemo/src/com/bo/
  85. ExpandableListViewDemo/src/com/bo/Group.java 190B
  86. ExpandableListViewDemo/src/com/bo/People.java 460B
  87. ExpandableListViewDemo/src/com/example/
  88. ExpandableListViewDemo/src/com/example/expandable/
  89. ExpandableListViewDemo/src/com/example/expandable/MainActivity.java 6.08KB
0评论
提交 加载更多评论
其他资源 ssh例子
用ssh框架简单实现的网络商城
AJAX+JSP TREE
AJAX+JSP实现动态树
download-NEU-DET
download-NEU-DET
httpcomponents-client-4.4-bin.zip
http client 开源JAR包HTTP 协议是现在的因特网最重要的协议之一。除了 WEB 浏览器之外, WEB 服务,基于网络的应用程序以及日益增长的网络计算不断扩展着 HTTP 协议的角色,使得越来越多的应用程序需要 HTTP 协议的支持。虽然 JAVA 类库 .net 包提供了基本功能,来使用 HTTP 协议访问网络资源,但是其灵活性和功能远不能满足很多应用程序的需要。而 Jakarta Commons HttpClient 组件寻求提供更为灵活,更加高效的 HTTP 协议支持,简化基于 HTTP 协议的应用程序的创建。 HttpClient 提供了很多的特性,支持最新的 HTTP 标准,可以访问这里了解更多关于 HttpClinet 的详细信息。目前有很多的开源项目都用到了 HttpClient 提供的 HTTP功能,登陆网址可以查看这些项目。本文中使用 HttpClinet 提供的类库来访问和下载 Internet上面的网页,在后续部分会详细介绍到其提供的两种请求网络资源的方法: Get 请求和 Post 请求。来自阿帕奇官网
高仿qq最新安卓版头像裁剪
高仿qq最新安卓版头像裁剪,详情查看csdn博客:http://blog.csdn.net/baiyuliang2013
spring-framework-2.1-m1
spring-framework-2.1-m1
软件开发常用图标
软件开发常用图标
webUploader Demo源码下载
web Uploader demo (有修改) 百度云及我遇到的问题汇总: https://blog.csdn.net/wx11408115/article/details/70215714