android - ExpandableList getChildView running twice per child -


i've got , expandablelist assign extended baseexpandablelistadapter. in here, implement getchildview method setup , return view each child:

public view getchildview(int groupindex, int childindex, boolean islastchild, view convertview, viewgroup parent) {      linearlayout layout;     if (convertview == null) {             layout = (linearlayout) layoutinflater.from(myapp.getcontext()).inflate(r.layout.rooms_room_list_row, parent, false);         } else {             layout = (linearlayout) convertview;          }      // custom stuff views on layout     ...      return layout;  } 

while debugging, i've noticed getchildview executed twice per child. values passed in (i.e, groupindex, childindex, islastchild) same... in group 3, if i've got 2 children, i'll see:

groupindex = 3, childindex = 0

then

groupindex = 3, childindex = 1

then repeats:

groupindex = 3, childindex = 0

and finally:

groupindex = 3, childindex = 1

my view appears fine, i.e, there 2 children listed group, why doing work?

update & answer

it seems if the listview set height of wrap_content getchildview called twice per child. changing height fill_parent seems fix behavior.

as mentioned in other question, listview calls getview() dimensions (width , height) of some items first, then calls getview() again render items. check this video out, it's "required reading" android. bit deals question @ minute 41:30.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -