applidium / HeaderListView

Android ListView with sticky headers
http://applidium.com/en/news/headerlistview_for_android/
Other
313 stars 96 forks source link

Can't use convertView in headers #38

Closed guilhermearaujo closed 9 years ago

guilhermearaujo commented 9 years ago

The method

public View getRowView(int section, int row, View convertView, ViewGroup parent)

in the SectionAdapter class is always called with convertView and parent as null.

From HeaderListView.java line 262:

View header = mAdapter.getSectionHeaderView(actualSection, null, null);

This way, we cannot reuse inflated headers.

Also, since the parent is null, it is impossible to instantiate a LayoutInflater simply by calling LayoutInflater.from(parent.getContext()). One workaround for this is to pass a context when creating the adapter, and then getting the inflater from that context.