Gibbsnich
Ambitioniertes Mitglied
- 0
Hallo,
ich möchte Daten aus einer SQL-Datenbank darstellen und benutze dazu eine Activity, die von ListActivity abgeleitet ist und einen SimpleCursorAdapter.
Passt soweit alles super, nur bekomme ich keine vernünftige Spaltenüberschriften hin.
Das Layout (siehe unten) ist zweizeilig und hat 2 bzw. 3 Spalten.
Ich habe ein Layout für die Form definiert und ein weiteres als Relative Layout für die Spalten der DB.
Ideal wäre es, ich könnte das Layout für einen Datensatz auch als Überschrift nutzen, dann würden die Anordnungen gleich passen.
Mein Versuch, mit einem Include das LAyout einzubinden, ging leider gar nicht.
Aktuell gebe ich nur 2 Textviews als Header aus:
Bezeichnung
Status
--------------------------------------
Liste Menü
offen Startseite 12
Ziel wäre z.B.:
Typ Bezeichnung
Status Modus ID
--------------------------------------
Liste Menü
offen Startseite 12
Wie kann ich so ein Layout umsezten?
Die Daten weise ich hier zu:
Mein Layout für den Dialog sieht so aus:
Die Datenzeile wird hier layoutet:
Irgendwelche Ideen?
Bitttteeee!!!
ich möchte Daten aus einer SQL-Datenbank darstellen und benutze dazu eine Activity, die von ListActivity abgeleitet ist und einen SimpleCursorAdapter.
Passt soweit alles super, nur bekomme ich keine vernünftige Spaltenüberschriften hin.
Das Layout (siehe unten) ist zweizeilig und hat 2 bzw. 3 Spalten.
Ich habe ein Layout für die Form definiert und ein weiteres als Relative Layout für die Spalten der DB.
Ideal wäre es, ich könnte das Layout für einen Datensatz auch als Überschrift nutzen, dann würden die Anordnungen gleich passen.
Mein Versuch, mit einem Include das LAyout einzubinden, ging leider gar nicht.
Aktuell gebe ich nur 2 Textviews als Header aus:
Bezeichnung
Status
--------------------------------------
Liste Menü
offen Startseite 12
Ziel wäre z.B.:
Typ Bezeichnung
Status Modus ID
--------------------------------------
Liste Menü
offen Startseite 12
Wie kann ich so ein Layout umsezten?
Die Daten weise ich hier zu:
Code:
private void fillData() {
cursor = myDataBase.fetchAllPreloadData();
startManagingCursor(cursor);
String[] from = new String[] { DB.prelo_ID, DB.prelo_TYP, // DB.prelo_SessionID,
DB.prelo_FlagStatus, DB.prelo_HybridModell,
DB.prelo_NameDialog };
int[] to = new int[] { R.id.galDatID, R.id.galDatTyp,
R.id.galDatStatus, R.id.galDatHybrid, R.id.galDatName };
// Now create an array adapter and set it to display using our row
SimpleCursorAdapter notes = new SimpleCursorAdapter(this,
R.layout.form_gallerydatarow, cursor, from, to);
setListAdapter(notes);
}
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/listBgColor">
<TextView android:id="@+id/galDatTitel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/red"
android:text="@string/fgdTitleName" />
<TextView android:id="@+id/galDatTitel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:text="@string/fgdTitleStatus" />
<ImageView android:id="@+id/filler"
android:layout_width="fill_parent"
android:layout_height="2px"
android:background="@color/listTitleSeparatorColor" />
<ListView android:id="@android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
android:drawSelectorOnTop="true"/>
</ListView>
<TextView android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fgdIsEmpty" />
</LinearLayout>
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/form_galdata_relative_row"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:layout_height="wrap_content"
android:layout_width="60dip"
android:layout_toRightOf="@+id/imageView1"
android:text="TextView"
android:id="@+id/galDatTyp"
android:textColor="@color/red"></TextView>
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_toRightOf="@+id/galDatTyp"
android:paddingLeft="6px"
android:text="TextView"
android:id="@+id/galDatName"
android:layout_alignParentRight="true"
android:textColor="@color/red"></TextView>
<TextView android:layout_height="wrap_content"
android:layout_width="60dip"
android:layout_below="@+id/galDatTyp"
android:text="TextView"
android:id="@+id/galDatStatus"
android:textColor="@color/black"></TextView>
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingLeft="6px"
android:layout_toRightOf="@+id/galDatStatus"
android:layout_alignParentTop="@+id/galDatStatus"
android:layout_below="@+id/galDatName"
android:text="TextView"
android:paddingRight="2dip"
android:id="@+id/galDatHybrid"
android:textColor="@color/black"></TextView>
<TextView android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_below="@+id/galDatName"
android:text="TextView"
android:id="@+id/galDatID"
android:textColor="@color/hidden"></TextView>
</RelativeLayout>
Bitttteeee!!!