1

I need to create an application with a list-view activity, but the elements in the list should be separated one from another and have more then one click option:

Here is the image:

enter image description here

so i can click on the on the task to see the task details and i can click on the left side of the task (the colored part) to change it's color, and this way to change it's priority

i would really appreciate if some one could provide me with a tutorial or additional reading information to creating such custom lists.

user
  • 86,916
  • 18
  • 197
  • 190
Emil Adz
  • 40,709
  • 36
  • 140
  • 187
  • Put the link to the image and someone with the permission to add images will edit it for you. – user Jan 15 '13 at 20:12

4 Answers4

5

divider and dividerHeight property of the ListView can make space between your listview items:

<ListView android:id="@+id/list_view"
  android:layout_height="fill_parent"
  android:layout_width="fill_parent"
  android:divider="@android:color/transparent"
  android:dividerHeight="10.0sp"/>

You can find some tutorial on how to build an Android Listview with Multiple Clickable Zones

K_Anas
  • 31,226
  • 9
  • 68
  • 81
  • Thanks for your reply, the Multiple Clickable Zones tutorial was a great deal of use to me, and I did implement a multi-tuch item list using it. i have an implementation of a row of my list but i have no ListView object inside my project. So i cant use the divider and the dividerHeight properties. – Emil Adz Jan 17 '13 at 04:23
0

You need to create a custom xml layout for list item. and in a listview give devider heght.. like i did here.

enter image description here

 <ListView
     android:id="@+id/lstContact"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:layout_below="@+id/lay"
     android:divider="#0000"
     android:dividerHeight="6dp"
     android:layout_marginTop="3dp"
     android:padding="5dp"
     android:background="#0000"
     android:cacheColorHint="#0000"
     android:scrollbars="none" />
NaserShaikh
  • 1,576
  • 2
  • 23
  • 39
0
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp" >

<ImageView
    android:id="@+id/icon"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_launcher" />

<TextView
    android:id="@+id/label"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Label" />

</LinearLayout>

You can use this as the layout for your list row in your list adapter. And you can acheive the spacing by increasing and decreasing the margin for the parent layout. Hope it will help you

Swati
  • 1,179
  • 9
  • 28
  • Thanks for your help but my row layout is far more complicated and changing the layout_mergin on the parent layout didn't helped me. – Emil Adz Jan 17 '13 at 04:25
0

I think you need to mention a shape.xml for each styling your row. And then in your row layout use an RelativeLayout for arranging the items. And make sure that you make the android:background="@android:color/transparent" for each button you create there. First one will be an ImageButton. enter image description here

This is what you can achieve. Let me know if this helps you.

Shraddha Shravagi
  • 1,096
  • 1
  • 9
  • 22
  • Thanks for your help @Sweety, I managed to achieve the desired result. you can see it here: http://stackoverflow.com/questions/14380383/change-listview-row-background-based-on-a-choice-from-other-activity – Emil Adz Jan 17 '13 at 14:03