Problem beim Layout, Spalten sind ungleichmässig

AndroidData

AndroidData

Fortgeschrittenes Mitglied
74
Hallo zusammen

Ich muss sagen, das ist ein tolles Forum, und es hat mir bisher auch immer gute Dienste geleistet, doch dieses (wahrscheinlich simple) Problem krieg ich einfach nicht gelöst

Ich habe eine Auflistung von Spielterminen, die ich in einer einzelnen Tabelle übersichtlich darstellen will. Dazu habe ich einen Adapter abgeleitet von BaseAdapter geschrieben. Doch nun kommt das Problem, ich kann es anstellen wie ich es will, die Einträge in dieser Tabelle sind nie schön untereinander, sondern immer voneinander versetzt, je nach dem welcher Spielort, Teamname oder Resultat. Ich möchte das Layout ja nicht mit fixer Breite angeben.

_______________________________________________
| 01.05.2012 | Spielort | Team 1 | 10 |
| 11:00 | | Team 2 | 15 |
_______________________________________________
| 01.05.2012 |anderer Spielort | Team 11111 | 10 |
| 11:00 | | Team 22222 | 15 |
_______________________________________________

Hat jemand einen Tipp, wie ich das angehen muss oder wo der Fehler in meinem XML File liegt?

PHP:
<?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:gravity="left"
    android:divider="@null" 
    android:dividerHeight="0px"
    android:orientation="horizontal" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="15"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/txtDatum"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="10dp"
                android:text="Datum" />

            <TextView
                android:id="@+id/txtZeit"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="10dp"
                android:text="Zeit" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="40"
            android:layout_gravity="left"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/txtSpielort"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:textSize="10dp"
                android:text="Spielort" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="35"
            android:layout_gravity="left"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/txtTeamGuest"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="10dp"
                android:text="Gastteam" />

            <TextView
                android:id="@+id/txtTeamHome"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="10dp"
                android:text="Heimteam" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="10"
            android:layout_gravity="left"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/txtResultat1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="10dp"
                android:text="Res1" />

            <TextView
                android:id="@+id/txtResultat2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="10dp"
                android:text="Res2" />

        </LinearLayout>

    </LinearLayout>
       
</LinearLayout>
Vielen Dank für eure Inputs.

Gruss René
 
versuch doch mal anstatt ein linear layout zu nehmen das table row (oder so) , dann kannst du eine tabelleanlegen und hast alles ordentlich untereinander.

und mit einem ralativ layout könnte es möglicherweise (habs noch nicht ausprobiert^^ ) auch funktionieren, solange du die abhängigkeit zum obersten tv definierst.

Vielleicht funkitioniert ja 1 der beiden ideen, viel glück ;)
 
  • Danke
Reaktionen: AndroidData
Hallo Keinbrain

Danke für den Input, mit dem Table-Layout hat es so einigermassen (oder zumindest brauchbar) geklappt.

Gruss René
 

Ähnliche Themen

S
  • Sempervivum
Antworten
2
Aufrufe
593
Sempervivum
S
L
Antworten
4
Aufrufe
1.316
lonnie9020
L
W
  • WuDiDong
Antworten
3
Aufrufe
755
jogimuc
J
Zurück
Oben Unten