ExpandableListView getGroupView friom子控件

时间:2015-11-04 14:08:56

标签: android listview expandablelistview

在Expandablelistview中,我想根据子视图中选定的控件更新其中一个groupview图像,如何实现这一点?  基本上  我想要这样

>>> A = [[1,2],[3,4],[5,6],[7,8],[9,10],[11,12]]
>>> zip(*A)
[(1, 3, 5, 7, 9, 11), (2, 4, 6, 8, 10, 12)]
>>> [list(tuple) for tuple in zip(*A)]
[[1, 3, 5, 7, 9, 11], [2, 4, 6, 8, 10, 12]]

EDIT 下面的代码使我

public View  getChildview(int groupPosition,final int childPosition, boolean isLastChild, View convertView,ViewGroup parent)
{

  View Groupview=parent.getChildAt(groupPosition); ///but gives null when if scrolling the expandablelist

}

2 个答案:

答案 0 :(得分:1)

我建议使用OnChildClickListener并覆盖onChildClick()并使用此code获取父视图。

答案 1 :(得分:0)

getGroupView() – Returns view for the list group header
getChildView() – Returns view for list child item
So u must create/inflate view in getChildView method 

更多详情:
http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/