This makes it so that when you touch anything around that area, you are triggering your "onClick" method.
In your Activity, you should have your onClick method simple toggle the checkbox.
In addition, you should disable the focusable/touchable properties for the checkbox so that there aren't any issues with both onClick methods getting called at the same time.
I hope this helps!
-Matt
www.sep.com/mcterry
On Thursday, March 22, 2012 10:16:41 AM UTC-4, Steve Garon wrote:
-- On Thursday, March 22, 2012 10:16:41 AM UTC-4, Steve Garon wrote:
Hi Android developers,I really loved the new gmail list view interface and though I could use something similar for my app but ran into a bit of problem. The goal I'm trying to achieve is to have a ListView with checkboxes on each items that if I click the list view item it open the detail view for that item and if I click the checkbox it triggers the action mode. I got that working but my problem is that the surface to check the checkbox is too small and it is difficult to actually press at the right place.I've attached picture highlighting the touch areas for my app and for the gmail app. Blue represent the surface that if pressed will check the checkbox and red represent the surface if pressed will open the detail view of the selected item.My App: (As you can see, the checkbox surface is really small)Gmail App:Next is my template for a list item. I use a horizontal linear layout to delimit the checkbox section and the item detail section. I would like the first part of my horizontal layout to to trigger the checkbox like it does in the gmail app.<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:paddingLeft="4dip" android:paddingRight="4dip" android:paddingTop="0dip" android:paddingBottom="2dip"> <LinearLayout android:id="@+id/LinearLayout00" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_gravity="center_vertical"> <ImageView android:id="@+id/id_torrent_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" android:layout_marginTop="2dip" android:scaleType="fitCenter" android:layout_gravity="center_vertical"/> <CheckBox android:id="@+id/id_torrent_cb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:focusable="false" android:focusableInTouchMode="false"/> </LinearLayout> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="0" android:layout_marginLeft="4dip"> <TableRow> <TextView android:id="@+id/id_torrent_name" android:layout_marginLeft="4dip" android:text="Ubuntu 8.04.iso" android:textAppearance="?android:attr/textAppearanceMedium" android:ellipsize="marquee" android:marqueeRepeatLimit="100" android:layout_span="4" android:layout_width="fill_parent" android:inputType="none" android:singleLine="true" /> </TableRow> <TableRow android:layout_width="fill_parent"> <TableLayout android:layout_height="wrap_content" android:layout_span="4" android:layout_width="fill_parent"> <TableRow android:layout_width="fill_parent"> <TextView android:id="@+id/id_torrent_speed" android:text="D:450Ko U:123Ko" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_gravity="left|center_vertical" android:layout_marginLeft="4dip" /> <TextView android:id="@+id/id_torrent_eta" android:text="1d 4h 2m" android:layout_marginLeft="4dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:lines="1" android:layout_gravity="right|center_vertical" /> </TableRow> </TableLayout> </TableRow> <TableRow> <LinearLayout android:id="@+id/LinearLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_marginRight="5dip"> <ProgressBar android:id="@+id/id_download_progress" android:max="100" android:progress="50" style="?android:attr/progressBarStyleHorizontal" android:layout_marginRight="2dip" android:layout_marginLeft="2dip" android:progressDrawable="@drawable/download_progress" android:layout_width="fill_parent" android:layout_height="7dip"/> <ProgressBar android:id="@+id/id_upload_progress" android:max="100" android:progress="50" style="?android:attr/progressBarStyleHorizontal" android:layout_marginRight="2dip" android:layout_marginLeft="2dip" android:progressDrawable="@drawable/upload_progress" android:layout_width="fill_parent" android:layout_height="7dip" android:layout_marginTop="2dip"/> <ProgressBar android:max="100" android:progress="50" style="?android:attr/progressBarStyleHorizontal" android:layout_marginRight="2dip" android:layout_marginLeft="2dip" android:layout_width="fill_parent" android:layout_height="7dip" android:layout_marginTop="2dip" android:id="@+id/id_unknow_progress" android:background="@drawable/progress_unknown" android:progressDrawable="@drawable/progress_unknown"/> </LinearLayout> <LinearLayout android:id="@+id/LinearLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="right" android:layout_marginRight="5dip" android:minWidth="150dip"> <TextView android:id="@+id/id_torrent_total_size" android:text="762 Mb" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_marginLeft="2dip" android:layout_gravity="center_vertical" android:layout_height="wrap_content" android:layout_width="wrap_content" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/RateSeparator" android:text="/" android:layout_marginLeft="2dip" android:layout_marginRight="2dip" android:layout_gravity="center_vertical" /> <TextView android:id="@+id/id_torrent_username" android:textAppearance="?android:attr/textAppearanceSmall" android:layout_gravity="center_vertical" android:text="administrator" android:layout_height="wrap_content" android:layout_width="wrap_content" /> </LinearLayout> </TableRow> </TableLayout> </LinearLayout>I really hope someone can help me fix that problem. I'm sure its really simple and its just something I overlooked or didn't understand properly.Thanks in advance,Steve
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment