How can I separate the returned fields from a SQLite database into a listview ? I'm using:
SimpleCursorAdapter adaptador = new SimpleCursorAdapter(this, R.layout.row_item, registros, from, to, 0);
Eele returns the fields correctly, but they appear like this in the listview:
Field1 Field2 Field3
I wanted it to look like this:
Field1 Field2 Field3
"row_item" file:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ECEFF1"
android:gravity="center_horizontal"
android:padding="3dp">
<TextView
android:id="@+id/col1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_span="1" />
<TextView
android:id="@+id/col2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_span="1" />
<TextView
android:id="@+id/col3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_span="1" />
<TextView
android:id="@+id/col4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_span="1" />
</TableRow>
</TableLayout>