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.

4

4 に答える 4

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

于 2013-01-15T20:44:25.663 に答える
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" />
于 2013-01-16T05:42:06.733 に答える
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

于 2013-01-16T09:24:29.050 に答える
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.

于 2013-01-17T05:51:57.350 に答える