Android中的ExpandableListView

一、ExpandableListView介绍
一个垂直滚动的显示两个级别(Child,Group)列表项的视图,列表项来自ExpandableListAdapter 。组可以单独展开。

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) :判断此组是否展开
ExpandableListContextMenuInfo menuInfo
=(ExpandableListContextMenuInfo)item.getMenuInfo();

String title
=((TextView)menuInfo.targetView).getText().toString();

int type=ExpandableListView.getPackedPositionType(menuInfo.packedPosition);
if (type==ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
int groupPos =ExpandableListView.getPackedPositionGroup(menuInfo.packedPosition);
int childPos =ExpandableListView.getPackedPositionChild(menuInfo.packedPosition);

具体请看安卓航班网。。。。

http://www.apkway.com/forum.php?mod=viewthread&tid=1403&extra=page%3D1

最新最全的安卓资讯,学习交流论坛  安卓航班网  www.apkway.com  请大家多多支持

posted on 2011-07-11 19:59  文艺小后生  阅读(370)  评论(0编辑  收藏  举报