实际上它不是 ListView 而是 ExpandableListView 但这并不重要。通常我会这样做:
<ScrollView >
<LinearLayout>
<ExpandableListView ... />
<TextView ... />
</LinearLayout>
</ScrollView>
..但我已经读过在 ScrollView 中使用 ListView 很费力。我尝试通过修改 ExpandListAdapter (getChildView()) 来解决这个问题:
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View view, ViewGroup parent) {
if(isLastChild){
LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.extra_info_bottom, null);
}
else{
//get normal item view
}
return view;
}
但这样我只能将孩子附加到组中。如何在任何组之外的底部附加 LinearLayout?