【发布时间】:2011-10-10 10:03:53
【问题描述】:
我正在使用 ExpandableListView。它工作正常,但我想添加一个 OnGroupExpandListener; 问题是如果我覆盖它,它的“基本”默认行为也会被覆盖。我基本上想要这样的东西:
mTeamListAdapter = new TeamListAdapter(getLayoutInflater());
mTeamList = (ExpandableListView) findViewById(R.id.screen_team_teamslist);
mTeamList.setAdapter(mTeamListAdapter);
mTeamList.setGroupIndicator(null);
mTeamList.setOnGroupExpandListener(new OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
// do my stuff..
// something like "super();" to enable the other default behaviour
}
});
具体来说,我想让 ExpandableListView 中每个组上的 Button 可见(并且可点击 - 之前是 "android:visibility="gone")。我仍然希望每个组及其子项也可以点击!
我该怎么做?
编辑:通过“基本默认行为”,我的意思是如果我覆盖该方法 (OnGroupExpand),我似乎无法再展开/折叠组了!
【问题讨论】:
-
设置
OnGroupExpandListener不会影响任何事情!!奇怪的。无论如何,尝试setGroupIndicator使用非空值?
标签: android listener expandablelistview