When populating ListView, activity crashes due to missing "layout_width" attribute
<p>I'm trying to populate a list of files, and I'm using a custom ArrayAdapter so that each list item contains multiple Views. The code I use to populate the list is:</p>

<pre><code>File home = MEDIA;
    int numFiles = home.listFiles().length;
    if(numFiles &gt;0) {
        ArrayList&lt;FileInfo&gt; fileData = new ArrayList&lt;FileInfo&gt;(numFiles);

        for (File file : home.listFiles()) {
            FileInfo data = new FileInfo();
            data.title = file.getName();
            data.desc = file.getAbsolutePath();

            fileData.add(data);
        }

        FileAdapter fileAdapter = new FileAdapter(this, R.layout.file_item, fileData);
        setListAdapter(fileAdapter);

    }
</code></pre>

<p>The main XML file looks like this: </p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;
    &lt;ListView android:id="@+id/android:list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:drawSelectorOnTop="false"/&gt;

    &lt;TextView android:id="@+id/android:empty"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="No files found on SD Card."/&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>And the file_item XML file looks like this:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android/com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent"&gt;
    &lt;TextView android:id="@+id/file_item_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/&gt;
    &lt;TextView android:id="@+id/file_item_desc"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>Any time I run this and it tries to populate the list, it throws an exception and crashes the application, throwing the error </p>

<pre><code>E/AndroidRuntime( 5320): FATAL EXCEPTION: main
E/AndroidRuntime( 5320): java.lang.RuntimeException: Binary XML file line #6: You must supply a layout_width attribute.
E/AndroidRuntime( 5320):    at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491)
E/AndroidRuntime( 5320):    at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:3600)
E/AndroidRuntime( 5320):    at android.view.ViewGroup$MarginLayoutParams.&lt;init&gt;(ViewGroup.java:3680)
</code></pre>

<p>If I add in an additional LinearLayout or something to the file_item XML file, the line that is missing the layout_width will change, which makes me think that it does believe that that first TextView in the file_item XML file is missing a layout_width attribute, but since there's one there already, I have no idea what it wants me to do.</p>
