0

I'm a beginner in Android development. I'm creating an application where I need to show products as a list with:

  • Thumbnail
  • Name
  • Price
  • Rating

I want to make it somewhat like the Apps list in Google play. Can someone direct me to a starting point in making that kind of UI? I think its something related to GridView but, if yes, not sure how to proceed. Thanks.

EDIT: I think people misunderstood my GooglePlay reference. Im pasting an image to show how I want my UI to be.

http://i49.tinypic.com/2cqjqx0.png (I'm not allowed to post images..)

I already have the tab swipes and everything. Only want to know how this type of list could be created. Thanks again!

Sudhanshu
  • 735
  • 1
  • 8
  • 20

3 Answers3

1

I think this and this is what you need. check out the links. They will be useful to you. Its called customize Listview

MysticMagicϡ
  • 28,593
  • 16
  • 73
  • 124
Auto-Droid ツ
  • 1,583
  • 1
  • 17
  • 31
  • Thanks for your reply. I've already created what you linked. But what I need is to make a grid with 2 items in each row and that list to go infinite. I'm completely clueless about how to do that! – Sudhanshu Jan 21 '13 at 06:42
  • http://stackoverflow.com/questions/12837780/android-set-the-gridview-to-have-2-columns-per-row-only – Auto-Droid ツ Jan 21 '13 at 06:53
  • http://stackoverflow.com/questions/7286900/dynamically-add-listview-in-the-code-to-scrollview/7287963#7287963 – Auto-Droid ツ Jan 21 '13 at 06:54
  • check the links it may be related – Auto-Droid ツ Jan 21 '13 at 06:54
  • Thanks the first link in the comment gave me a fair idea of how I might try to implement it! Let me try it first though... – Sudhanshu Jan 21 '13 at 07:26
  • Could you please EDIT your answer to include [http://stackoverflow.com/questions/12837780/android-set-the-gridview-to-have-2-columns-per-row-only] link? I will accept your answer then. – Sudhanshu Jan 21 '13 at 09:13
1

What you need to do is to create a custom view called layout for a list Item .

Following code will create a list item of your choice. Modify code as per your requirement. But you can idea from following code.

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

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:src="@drawable/ic_launcher" />

<TextView
    android:id="@+id/txtItemName"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_toRightOf="@+id/imageView1"
    android:text="Item Name"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
    android:id="@+id/txtItemPrice"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/imageView1"
    android:layout_alignLeft="@+id/txtItemName"
    android:text="Item Price" />

<TextView
    android:id="@+id/txtRating"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/textView1"
    android:layout_alignBottom="@+id/textView1"
    android:layout_alignParentRight="true"
    android:text="Rating"
    android:textAppearance="?android:attr/textAppearanceSmall" />

Just copy and paste above code in your layout and switch to Graphical Layout. You can see outcome.

Following links helps you how to use customized layout in your list view. Custom List1 and Custom List2

Chintan Rathod
  • 25,864
  • 13
  • 83
  • 93
0

This two way Android GridView that can be configured to scroll horizontally or vertically.

This gridview is what you are looking for.

Hope it helps :)

AndroidLearner
  • 4,500
  • 4
  • 31
  • 62
  • I looked at it. This utility looks great but it doesnt explain how it implements 2 items in each row and how to go about implementing THAT. Thanks anyways :) – Sudhanshu Jan 21 '13 at 07:06
  • well,you can review that code.I know there is not much explanation about this,but there is useful comments in the code,so we can read and learn from that.I also wants this kind of functionality in my project and by doing some googling i found this project.Any ways,if my answer useful to you then don't forget to accept it :) – AndroidLearner Jan 21 '13 at 07:09