简体   繁体   中英

What is the android equivalent to an iOS uitableviewstylegrouped

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"

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>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM