Skip to content

Instantly share code, notes, and snippets.

@moltak
Created April 11, 2014 11:05
Show Gist options
  • Save moltak/10458814 to your computer and use it in GitHub Desktop.
Save moltak/10458814 to your computer and use it in GitHub Desktop.
ExpandableListView in Scrollview
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.expandable, container, false);
ExpandableAdapter adapter = new ExpandableAdapter();
expandableListView.setAdapter(adapter);
setExpandableListViewHeight(expandableListView, -1);
expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int position, long id) {
setExpandableListViewHeight(parent, position);
return false;
}
});
return view;
}
@krzysztof90
Copy link

I would only add after children loop

totalHeight += (listView.getDividerHeight() * (listAdapter.getChildrenCount(i) - 1));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment