0
我试图创建2级的expandableListView.I可以获取数据并完美绑定到UI元素,但两个孩子之间的高度是固定的。 因为内部ExpandableListView就像在scrollview里面我只看到一个项目。ExpandableListView在另一个ExpandableListView问题
*group1
^child1
//data
^child2
//data
*group2
^child1
//data
^child2
//dataa
我使用下面的方法设置孩子的身高dynamically.i.e 1与组2之间的hieght:
ListAdapter listadp = lv_ancillaryservice.getAdapter();
if (listadp != null) {
int totalHeight = 0;
for (int i = 0; i < listadp.getCount(); i++) {
View listItem = listadp.getView(i, null, lv_ancillaryservice);
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = lv_ancillaryservice.getLayoutParams();
params.height = totalHeight + (lv_ancillaryservice.getDividerHeight() * (listadp.getCount() - 1));
lv_ancillaryservice.setLayoutParams(params);
lv_ancillaryservice.requestLayout();
我上面使用,因为usingwrap_content亘古不变的列表视图的工作。现在的问题是:
- 被点击1组时,^ child1和^的child2是shownup和child1点击时,我有一个列表视图,但我无法看到完整的列表(第2组的位置是固定的)。
- 滚动是没有工作的地方。