class="java"> // ListView 自适应高度 int totalHeight = 0;// 总的高度 for (int i = 0; i < adapter.getCount(); i++) { View listItem = adapter.getView(i, null, vListSize); // list1,当前listview listItem.measure(0, 0); totalHeight += listItem.getMeasuredHeight(); } ViewGroup.LayoutParams params = vListSize.getLayoutParams(); params.height = totalHeight + (vListSize.getDividerHeight() * (adapter.getCount() - 1)); vListSize.setLayoutParams(params);