Tabelle erstellen

  • 0 Antworten
  • Letztes Antwortdatum
S

Simon93

Neues Mitglied
1
Ich programmiere derzeit eine App, die Werte in einer Tabelle darstellen kann.
Es kommen während der Ausführung der App mehrfach neue Zeilen dazu.
Im Moment habe ich es so realisiert, dass die die Felder als TextView habe, und die Zeilen und Spalten einfach durch ein ImageView umsetze.
Im Moment sind es IMMER 4 Spalten, was ich evtl in einer späteren Version ändern möchte.
Mein Problem ist, dass alle 4 TextView Felder gleich viel Platz einnehmen sollen, egal ob die App, im Quer- oder Hochformat läuft.
Ich füge mal den Code der XML Datei an:
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
<TableLayout 
            android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:layout_marginTop="5dp" >
            <TableRow 
                android:layout_width="match_parent"
                   android:layout_height="wrap_content" >
        <TextView
            android:id="@+id/textView1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall" />
        <ImageView  
                    android:layout_width="2dp"
                       android:layout_height="30dp"
                       android:src="@drawable/balken"/>
        <TextView
            android:id="@+id/textView2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall" />
        <ImageView 
                    android:layout_width="2dp"
                       android:layout_height="30dp"
                       android:src="@drawable/balken"/>
        <TextView
            android:id="@+id/textView3"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall" />

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:src="@drawable/balken" />

        <TextView
            android:id="@+id/textView4"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall" />
        <ImageView 
                android:layout_width="480dp"
                   android:layout_height="2dp"
                   android:src="@drawable/balken_land"/>
        </TableRow>
</TableLayout>
</LinearLayout>
 

Ähnliche Themen

Jennywise
Antworten
2
Aufrufe
677
Jennywise
Jennywise
Zurück
Oben Unten