title: ViewGroup{TextView,...}.getMeasuredHeight gives wrong value is smaller than real height
body: <pre><code>  { January 14, 2011... I have given up to use setListViewHeightBasedOnChildren(ListView listView},
    instead, I don't put my listview in a scrollview, and then just put other contents
    into a listview by using ListView.addHeaderView() and ListView.addFooterView(). 
    http://dewr.egloos.com/5467045 }
  </code></pre>
  
  <p>ViewGroup(the ViewGroup is containing TextViews having long text except line-feed-character).getMeasuredHeight returns wrong value... that is smaller than real height.</p>
  
  <p>how to get rid of this problem?</p>
  
  <p>here is the java code:</p>
  
  <pre><code>    /*
      I have to set my listview's height by myself. because
      if a listview is in a scrollview then that will be
      as short as the listview's just one item.
      */
      public static void setListViewHeightBasedOnChildren(ListView listView) {
      ListAdapter listAdapter = listView.getAdapter(); 
      if (listAdapter == null) {
          // pre-condition
          return;
      }
  
      int totalHeight = 0;
      int count = listAdapter.getCount();
      for (int i = 0; i &lt; count; i++) {
          View listItem = listAdapter.getView(i, null, listView);
          listItem.measure(View.MeasureSpec.AT_MOST, View.MeasureSpec.UNSPECIFIED);
          totalHeight += listItem.getMeasuredHeight();
      }
  
      ViewGroup.LayoutParams params = listView.getLayoutParams();
      params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
      listView.setLayoutParams(params);
  }
  </code></pre>
  
  <p>and here is the list_item_comments.xml:</p>
  
  <p>
       
        
     
     
    
   </p>