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>
Du musst angemeldet sein, um einen Kommentar abzugeben.
Ist der bug hier:
Blick auf das Ende der Zeile, die mit LinearLayout. Sie hinterließ ein > das schließt den tag, was bedeutet, dass die Attribute, die Folgen behandelt, die der XML-parser als einen block von text, Kind des LinearLayout tag. Entfernen Sie einfach die extra - > und du wirst in Ordnung sein.
Bezug auf Ihren Kommentar, es gibt keine Android-widget für ein label. Sie wahrscheinlich wollen eine TextView statt.
Dies ist nicht eine Antwort auf dein spezifisches problem, sondern eher eine andere Ursache für den gleichen Fehler.
Ich hatte einen ähnlichen Fehler, nur mein Problem war, dass ich ins schema, dann eher schemas
ie.
Hoffe, das hilft anderen.