Android Liste zeigt Spalten falsch an

Nersgatt

Mitglied
Hallo,

ich habe ein Problem mit einem ListView. Ich möchte 4 Spalten nebeneinander anzeigen und natürlich mehrere Zeilen.
Leider werden die horizontalen Werte nicht nebeneinander angezeigt, sondern untereinander. Und ich verstehe nicht, warum das so ist.

Der Container mit dem ListView sieht so aus:
[XML]<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:eek:rientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Datum" android:layout_width="80dp" android:layout_height="wrap_content" android:id="@+id/textView1"></TextView>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:layout_height="wrap_content" android:id="@+id/textView2" android:layout_width="80dp" android:text="@string/Breite"></TextView>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:layout_height="wrap_content" android:id="@+id/textView3" android:layout_width="80dp" android:text="@string/Tiefe"></TextView>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:layout_height="wrap_content" android:id="@+id/textView4" android:text="@string/Flaeche" android:layout_width="fill_parent"></TextView>
</LinearLayout>

<ListView
android:id="@android:id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></ListView>

</LinearLayout>[/XML]
Also eine Kopfzeile mit Spaltenüberschrifen. Darunter das ListView.

Dazu das Item:
[XML]<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:eek:rientation="vertical">
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:eek:rientation="horizontal">
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Datum" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtDatum"></TextView>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Breite" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtArbeitsbreite"></TextView>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Tiefe" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtArbeitstiefe"></TextView>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Flaeche" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/txtFlaeche"></TextView>
</LinearLayout>

</LinearLayout>[/XML]
Im Prinzip also nur 4 TextViews die in einem LinearLayout (horizontal).

Trotzdem werden die Spalten untereinander angezeigt (siehe Screenshot).
Ich hab keine Idee, woran das liegt. Würde mich freuen, wenn mir jemand helfen kann.

Jens
 

Anhänge

  • Spalten.jpg
    Spalten.jpg
    63,7 KB · Aufrufe: 40

Bolle52

Aktives Mitglied
Dazu das Item:
[XML]<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:eek:rientation="vertical">
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:eek:rientation="horizontal">
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Datum" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtDatum"></TextView>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Breite" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtArbeitsbreite"></TextView>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Tiefe" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtArbeitstiefe"></TextView>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Flaeche" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/txtFlaeche"></TextView>
</LinearLayout>

</LinearLayout>[/XML]

versuche es mal mit einem tablelayout, anstatt mit einem linearlayoutHello, TableLayout | Android Developers:

[XML]<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:eek:rientation="vertical">
<HierLinearLayout>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Datum" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtDatum"></TextView>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Breite" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtArbeitsbreite"></TextView>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Tiefe" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtArbeitstiefe"></TextView>
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Flaeche" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/txtFlaeche"></TextView>
</EndeTableLayout>

</LinearLayout>[/XML]
 

Nersgatt

Mitglied
Danke für die Antwort. Ich hab die Lösung gefunden. Das Layout kann das gar nichts dafür. Ich hatte beim Befüllen der Liste einen Fehler, so dass immer eine Spalten gefüllt wurde und die anderen Spalten leer waren. So wurde es dann natürlich auch dargestellt, und untereinander weil die Textfelder auf "WrapContent" eingestellt waren.
Klarer Fall von JZD (*).

Gruß,
Jens

(*) Jens zu doof
 

Ähnliche Java Themen

Neue Themen


Oben