user6313669 user6313669 - 4 months ago 6
Android Question

I want to make a list view like this image . So what layout would be suitable for this?

enter image description here

I want to make a

listview
like this image . So what layout would be suitable for this ?

I am using this xml code . Please tell me how can i get like this image . between two item of list is proper space is present .

list_row.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_row_selector"
android:padding="8dp" >

<!-- Thumbnail Image -->
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/thumbnail"
android:layout_width="120dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginRight="8dp" />

<!-- Restaurant name -->
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

android:layout_toRightOf="@+id/thumbnail"
android:textSize="@dimen/title"
android:textStyle="bold" />

<TextView
android:id="@+id/area"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/name"
android:textColor="#D2691E"
android:layout_toRightOf="@+id/thumbnail"
android:textSize="@dimen/rating" />

<!-- Rating -->
<TextView
android:id="@+id/average_ratings"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/area"
android:textColor="#D2691E"
android:layout_toRightOf="@+id/thumbnail"

android:textSize="@dimen/rating" />

<TextView
android:id="@+id/cuisine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/average_ratings"
android:textColor="#D2691E"
android:layout_toRightOf="@+id/thumbnail"
android:textSize="@dimen/rating" />

<!-- Genre -->
<!-- <TextView
android:id="@+id/genre"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/rating"
android:layout_marginTop="5dp"
android:layout_toRightOf="@+id/thumbnail"
android:textColor="@color/genre"
android:textSize="@dimen/genre" />-->
<!--
&lt;!&ndash; Release Year &ndash;&gt;
<TextView
android:id="@+id/releaseYear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:textColor="@color/year"
android:textSize="@dimen/year" />-->

</RelativeLayout>


using of this i am getting like this image .

enter image description here

Answer

Its called card view use recycler view to fetch the cards, Its very efficient than list view.

Link: https://developer.android.com/training/material/lists-cards.html

Example app:http://www.androidhive.info/2016/05/android-working-with-card-view-and-recycler-view/