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組的位置是固定的)。
- 滾動是沒有工作的地方。