Erste Nachricht in der android-app: Binary XML file line #2: Sie müssen die Versorgung einer layout_width Attribut

Ich versuche, einen ListView innerhalb von ein RelativeLayout aber wenn ich meine app bekomme ich eine runtimeexception mit der Meldung:

Binary XML file line #2: Sie müssen die Versorgung einer layout_width Attribut.

Habe ich versucht, dass layout_width Attribute in jedem nur erdenklichen Ort in der xml-Ressource-Dateien, aber bisher kein Glück.

Ich versuche zum füllen der listview mit dieser code-Zeile:

   .setListAdapter(new ArrayAdapter(this,
           R.layout.tablerow3, R.id.label,
           items));

Hier ist die tablerow3.xml Inhalt:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
    android:layout_width="20dp"
    android:layout_height="5dp"
    android:id="@+id/tablerow01">

    <Label android:id="@+id/label01"
        android:layout_width="5dp"
        android:layout_height="5dp"
        android:textColor="@color/solid_white"
        android:singleLine="true"/>

    <Label android:id="@+id/label02"
        android:layout_width="5dp"
        android:layout_height="5dp"
        android:textColor="@color/solid_white"
        android:singleLine="true"/>
</LinearLayout>

Hier die xml enthält die RelativeLayout(forex2.xml):

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <Button android:text="Static Button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:id="@+id/button_id">
    </Button>

    <Spinner android:id="@+id/spinner1"
        android:layout_width="match_parent"
        android:layout_toRightOf="@id/button_id"
        android:layout_alignParentTop="true"
        android:layout_height="wrap_content"
        android:drawSelectorOnTop="true"
    />

    <ListView android:id="@android:id/list"  
        android:layout_width="5dp"
        android:layout_height="5dp"
        android:layout_alignParentBottom="true"
     />
  <!--  android:layout_width="wrap_content"
        android:layout_height="wrap_content" --> 
</RelativeLayout>
InformationsquelleAutor opike | 2011-01-12
Schreibe einen Kommentar