how to split listview row into three columns and one of the column into vertically two in android

Viewed 1022

I need to list contacts in a list view to show image, Contact name, Number and call icon for each row item.

Each row should split into three columns. First column will have contact image, and second column to be vertically divided into two, first one for Contact name, and second one for Number. and the last column will have a icon/image.

required layout

i tried below. but not getting required format. is this possible to do with Listview as we trtied below (instead of gridview)?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ListView
        android:id="@+id/listView_all_cont"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#a556f4"
        android:scrollbars="horizontal"/>


    <ImageView
        android:id="@+id/imgView_contImg"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:src="@drawable/no_image" />

    <TextView
        android:id="@+id/txtView_name"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:textColor="#ffffff"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/txtView_number"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:textColor="#ffffff"
        android:textSize="14sp" />

</LinearLayout>

can somebody help here?

2 Answers
Related