Listview android

Asked

Viewed 178 times

1

How can I separate the returned fields from one Sqlite database in a listview? I’m using:

SimpleCursorAdapter adaptador = new SimpleCursorAdapter(this, R.layout.row_item, registros, from, to, 0);

It returns the fields correctly, but appears like this in listview:

Campo1campo2campo3

I wish you’d show up like this:

Campo1 Campo2 Campo3

File "row_item":

<?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>
  • 1

    Where is the part of the code where values are assigned to registros?

  • It would be possible to post an image of how it is adapting in Listview ?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.