0

I have data in the form of an array of key value pairs. Some of the data is related to other data in the array. What is the best way to show this in android? I know that a uitableview of uitableviewstylegrouped would be best for iOS but what is the best approach in Android?

This is some example data I would like to group into sections:


FirstName, "Joe"

LastName, "Smith"


Phone Number, "555-5555"

email, "joesmith@gmail.com"

Atma
  • 29,141
  • 56
  • 198
  • 299
  • I think the answer could be that there is no equivalent. There no real way to group cells. I think sHaH's answer maybe closest, but again, not what I'm looking for. – Atma Oct 12 '11 at 19:16

2 Answers2

0

Check TableLayout

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">

<TableRow>
    <TextView
        android:layout_column="1"
        android:text="FirstName"
        android:padding="3dip" />
    <TextView
        android:text="Joe"
        android:gravity="right"
        android:padding="3dip" />
</TableRow>

<TableRow>
    <TextView
        android:layout_column="1"
        android:text="LastName"
        android:padding="3dip" />
    <TextView
        android:text="Smith"
        android:gravity="right"
        android:padding="3dip" />
</TableRow>

<View
    android:layout_height="2dip"
    android:background="#FF909090" />

<TableRow>
    <TextView
        android:layout_column="1"
        android:text="Phone Number"
        android:padding="3dip" />
    <TextView
        android:text="555-5555"
        android:gravity="right"
        android:padding="3dip" />
</TableRow>

<TableRow>
    <TextView
        android:text="Email"
        android:padding="3dip" />
    <TextView
        android:text="joeSmith@gmail.com"
        android:gravity="right"
        android:padding="3dip" />
</TableRow>

</TableLayout>
Sherif elKhatib
  • 45,786
  • 16
  • 89
  • 106
0

YOu need to use the Simple ListView in Android to show up the List Now the problem is you want to show it like an iOS UITableView, so you need to make the background of the listView white and round the corners of the ListView.

This link might be helpful for you how to make the corners rounded of list View..

How do I create a ListView with rounded corners in Android?

Tell me more if you have any queries.

Community
  • 1
  • 1
Shah
  • 4,990
  • 10
  • 48
  • 70