title: Correct way to implement onMeasure() and onLayout() in custom AdapterView
body: <p>I know that I should measure children in <code>onMeasure()</code> and layout them in <code>onLayout()</code>. The question is in what of these methods should I add/recycle views so I could measure all children together with an eye on how they are mutually positioned (i.e. grid, list or whatever)?</p>
  
  <p>My first approach was to add/recycle views in <code>onLayout()</code> but from that point I can't measure my children because they aren't added to AdapterView yet and <code>getChildCount()</code> returns <code>0</code> in <code>onMeasure()</code>. And I can't measure AdapterView itself without children being already layouted because it really depends upon their mutual positions, right?</p>
  
  <p>I'm really confused with android layouting process in AdapterView when childrens are added/removed dynamically.</p>