title: Is it possible to set listView maxHeight in xml?
body: <p>Having a <code>listView</code>, if it has less content its height should go with <code>"wrap_content"</code>. If it has more rows the max height should be limit to some height.</p>
  
  <p>It is allowed to set <code>android:maxHeight</code> in <code>ListView</code>:</p>
  
  <pre><code>&lt;ListView&gt;
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:maxHeight="120dp"
  &lt;/ListView&gt;
  </code></pre>
  
  <p>but it does not work and always <code>"wrap_content"</code>. 
  There only way to make it work is in code use</p>
  
  <pre><code>int cHeight = parentContainer.getHeight();
  ViewGroup.LayoutParams lp = mListView.getLayoutParams();
  
  if (messageListRow &gt; n) 
  {
      lp.height = (int)(cHeight * 0.333);
  } 
  else 
  {
      lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
  }
  
  mListView.setLayoutParams(lp);
  </code></pre>
  
  <p>Is there a way to do it in xml?</p>