title: ListView item won't extend width to fill_parent
body: <p>I have a custom <code>ViewGroup</code> that inflates a <code>ListView</code> from an <code>xml</code> layout. The list item layout is inflated from another <code>xml</code> file. All of the views are set to <code>fill_parent</code>. The <code>ListView</code> fills its parent, but the <code>ListView</code> items don't.</p>
  
  <p>I've tried putting the <code>ListView</code> in a <code>LinearLayout</code> and assigning weight to it. Tried <code>RelativeLayout</code> as well. Also, I've built the <code>ListView</code> programmaticaly, without using the <code>xml</code> layout. Even changed the <code>LayoutParams</code> before adding the view to the <code>ViewGroup</code>. </p>
  
  <p>I've also taken in consideration these posts as well: <a href="https://stackoverflow.com/q/6497000/935627">Width of clickable area in ListView w/ onListItemClick</a>, <a href="https://stackoverflow.com/q/3210337/935627">In Android, how can I set a ListView item's height and width?</a>, <a href="https://stackoverflow.com/q/8064416/935627">Android Listview width prob</a>.</p>
  
  <p>Any ideas to why the items don't extend to fill width? And how to extend them?</p>
  
  <p><strong>MyViewGroup class:</strong></p>
  
  <pre><code>public class MyViewGroup extends ViewGroup {
  
      public MyViewGroup(Context context, AttributeSet attrs) {
          super(context, attrs);
          generateMyViewGroup();
  
      }
  
      private void generateMyViewGroup()
      {
          ListView main = (ListView) View.inflate(getContext(), R.layout.layout_main, null);
  
          main.setAdapter(new MyAdapter(getContext()));
  
          this.addView(main);     
      }
  
      @Override
      protected void onLayout(boolean changed, int l, int t, int r, int b) {
          this.getChildAt(0).layout(l, t, r, b);
      }
  }
  </code></pre>
  
  <p><strong><code>ListView</code> <code>xml</code> layout:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ListView xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@android:id/list"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_marginRight="3dp"
      android:background="#77000000"
      android:cacheColorHint="#00000000"
      android:divider="#00000000"
      android:dividerHeight="0dp"
      android:drawSelectorOnTop="false"
      android:scrollbars="vertical" &gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p><strong><code>ListView</code> item layout:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/layout_main_category"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:background="@color/mainBackground"
      android:gravity="fill_horizontal|center_vertical"
      android:orientation="vertical" &gt;
  
      &lt;TextView
          android:id="@+id/main_category"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_marginLeft="8dp"
          android:layout_marginRight="8dp"
          android:paddingBottom="7dp"
          android:paddingLeft="20dp"
          android:paddingRight="5dp"
          android:paddingTop="20dp"
          android:text="test"
          android:textColor="@color/mainCategory"
          android:textSize="15sp"
          android:textStyle="bold" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>Part of <code>MyAddapter</code> class:</strong></p>
  
  <pre><code>public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder viewHolder;
  
      if(null == convertView)
      {
          LayoutInflater inflater = LayoutInflater.from(context);
          convertView = inflater.inflate(R.layout.layout_main_category, null);
  
          viewHolder = new ViewHolder();
  
          viewHolder.mainItemTitle = (TextView) convertView.findViewById(R.id.main_category);
  
          convertView.setTag(viewHolder);
      } else {
          viewHolder = (ViewHolder) convertView.getTag(); 
      }
  
      viewHolder.mainItemTitle.setText("text");
  
      return convertView;
  }
  
  private static class ViewHolder {
          public TextView menuItemTitle;
  }
  </code></pre>