I've run into the same task with my current app. Especially true if you consider the different checkbox sizes on various platform versions.
What I ended up with is a custom layout class at the top level of my item layout that does its own event tracking. 23.03.2012 11:05 пользователь "Steve Garon" <steve.ga...@gmail.com> написал: > 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) > > <https://lh4.googleusercontent.com/-C6QFWOcMm3c/T2stOw9VIRI/AAAAAAAAQ4o/awWzM_mupo4/s1600/Screenshot_2012-03-09-13-19-23.png> > > > > > > > > Gmail App: > > <https://lh3.googleusercontent.com/-jgunldMGimk/T2stOztkbuI/AAAAAAAAQ4k/kujie19WWeM/s1600/Screenshot_2012-03-21-22-30-11.png> > > > > > > > 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+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en